-
Notifications
You must be signed in to change notification settings - Fork 974
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
Firestore emulator fails to retrieve refresh_token in CI, errors out #1966
Comments
A wild @joelpoloney appears! 👋 I thought I'd seen all the auth errors but this is a new one for me. Have you ever seen this locally or only on Cloud Build? Also are you trying to access any production resources from the emulator or should it all be self-contained? |
Hi!! 👋 We have not run into this locally... it's only appearing on Cloud Build. We're not trying to access any production resources at all -- we want to run our unit tests without talking to production. We were using the That said, should we be auth'ing the emulator somehow? Perhaps we just set it up wrong? |
That said, we were in the middle of upgrading all of our dependencies and realized Cloud Build was still on Node 10.15. I've updated to Node 12.15.0 and Yarn 1.21.0 and will continue to monitor... but reading the error, this feels platform (node/yarn) independent. |
So fundamentally it looks like you're getting a 404 from some auth service, which is either a bug in Cloud Run's networking or in the However I think we can work around it. Here's where you're running into issues: So I think what we want to do is have you authenticate with a token. If you run this on your personal machine:
You will get a permanent token that you can use to authorize the CI. You can then pass that to the Firebase CLI in two ways:
As for getting it securely into Cloud Build, you can encrypt it using Cloud KMS and then get Cloud Build to bring it in for you as Another option is to authenticate with a service account JSON key ( |
Ah ok great. This is probably the issue -- having a permanent token looks like it fixes it. I'll try the route with KMS and report back how it goes. Thank you for the super detailed info! |
I followed these instructions to get a variable setup: https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-secrets-credentials#example_build_request_using_an_encrypted_variable. That combined with your
|
Resolution above. Closing this out. Thank you!!! |
@joelpoloney glad you figured it out! @yuchenshi @markarndt maybe a good addition to Emulator + CI docs. |
@joelpoloney turns out there was an issue on our side too, #1973 fixes it and will be included in a patch release very soon. So you should be able to remove |
Ah good to know. Thank you for the heads up! |
[REQUIRED] Environment info
firebase-tools: 7.12.1
Platform: Linux
[REQUIRED] Test case
Starting the simulator in Google Cloud Build fails randomly and is causing our tests to be flaky
[REQUIRED] Steps to reproduce
Right now I'm running
lerna
withjest
. The command is run on Node 10.15.1 on Cloud Build. Here's theyarn
command I'm running:firebase emulators:exec --only firestore 'yarn jest'"
.The
yarn jest
command looks like:"jest": "FIRESTORE_EMULATOR_HOST=localhost:9090 jest --runInBand --coverage"
When run with the
--debug
flag, I get some more information and a stack trace of where things blew up:[REQUIRED] Expected behavior
Does not crash
[REQUIRED] Actual behavior
Crashes
The text was updated successfully, but these errors were encountered: