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

fix(examples/firebase-auth-firestore): Fix imports and throw meaningful errors when missing .env #3353

Merged
merged 2 commits into from
Jun 1, 2022

Conversation

penx
Copy link
Contributor

@penx penx commented Jun 1, 2022

Apply fixes as per comment by @mocon at #1811 (comment)

Also:

  • throw meaningul errors when environment variables are missing or can't be parsed.
  • check for existence of environment variable rather than cast to string

Closes: issue reported in comment #1811 (comment)

  • Docs N/A
  • Tests - is there a way to add integration tests for the examples?

Testing Strategy:

cd examples/firebase-auth-firestore
yarn
yarn dev
# open http://localhost:3000
# assert "Error: Missing CLIENT_CONFIG environment variable" thrown as env variables are missing
# exit ^C
cp .env.example .env
yarn dev
# open http://localhost:3000
# assert "Error: Failed to parse private key" thrown as example env does not contain valid keys
# exit ^C
# edit .env and set CLIENT_CONFIG to invalid JSON
yarn dev
# open http://localhost:3000
# assert "Error: Invalid CLIENT_CONFIG environment variable"
# exit ^C
# edit .env and set valid keys
yarn dev
# open http://localhost:3000
# assert login page loads

I plan to follow up with a few other PRs:

penx added 2 commits June 1, 2022 11:38
Apply fixes as per comment by @mocon at remix-run#1811 (comment)

Also:

- throw meaningul errors when environment variables are missing or can't be parsed.
- check for existence of environment variable rather than cast to string
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Thanks!

@kentcdodds kentcdodds merged commit ee73bd5 into remix-run:main Jun 1, 2022
@penx penx deleted the fix-firebase-example branch June 1, 2022 12:02
eastlondoner pushed a commit to eastlondoner/remix that referenced this pull request Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants