Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Env Variable Check in Metadata Form Workflow #309

Closed
4 tasks done
sorochak opened this issue Jan 26, 2024 · 2 comments · Fixed by #315
Closed
4 tasks done

Integrate Env Variable Check in Metadata Form Workflow #309

sorochak opened this issue Jan 26, 2024 · 2 comments · Fixed by #315
Assignees
Labels
enhancement New feature or request

Comments

@sorochak
Copy link
Contributor

sorochak commented Jan 26, 2024

Issue Summary

The Metadata Entry Form currently lacks a check for necessary Authentication environment variables required by Firebase functions. This can lead to deployments with missing or incorrect configurations, potentially causing runtime errors.

This issue was inspired by a similar problem encountered in cioos-siooc/metadata-entry-form#307, where the automatic GitHub issue creation feature for records submissions was found to be broken, due to missing the GITHUB_AUTH env variable. There have been other previous occurrences where functions authentication has been broken due to missing env variables.

When a maintainer deploys Firebase functions from their local machine, if their local .env is missing any required variables, the deployed functions may lose access to credentials.

Proposed Solution

To prevent such issues in our deployments, I propose updating README instructions to instruct maintainers not to deploy Firebase functions from their local, and to run the Deploy Firebase Functions workflow on their feature branch.

Since the above solution won't prevent functions from being deployed from a local machine (potentially missing env variable creds), some kind of automated environment variable check is also required.

Perhaps when a user first visits the Metadata Form, an automated check can run to ensure the Firebase functions don't have any authentication errors, if an auth error is found, then a notification mechanism (Sentry?) is triggered to alert Team members.

Required Environment Variables (can someone confirm the below list encompasses all required variables?)

  • FIREBASE_TOKEN
  • GMAIL_USER
  • GMAIL_PASS
  • DATACITE_USER
  • DATACITE_PASS (unsure if USER & PASS is required, or just the Auth Hash below, I think the Auth hash contains both user and pass, the Datacite functions use DATACITE_AUTH_HASH as Auth in their Post header, but the Deploy Firebase Functions workflow includes DATACITE_USER and DATACITE_PASS but not DATACITE_AUTH_HASH - potential problem there?)
  • DATACITE_AUTH_HASH
  • AWS_REGION
  • AWS_ACCESSKEYID
  • AWS_SECRETACCESSKEY
  • GITHUB_AUTH

Action Items

  • Update README to include Firebase functions deployment guidelines
  • Confirm list of required Environment Variables (will likely evolve over time as new features are added)
  • Propose solution for automated functions creds check and notification mechanism
  • Implement automated cred check and auth error notification
@sorochak
Copy link
Contributor Author

@fostermh @n-a-t-e any input/thoughts on this issue?

@fostermh
Copy link
Member

we could consider switching to parameterized config settings? https://firebase.google.com/docs/functions/config-env?gen=2nd#params

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants