-
Notifications
You must be signed in to change notification settings - Fork 955
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
firebase serve
fails with TypeError on Travis CI
#364
Comments
Hey @sergeybekrin thanks for the report! This is definitely an edge case that we overlooked. In the meanwhile, here's a workaround.
Please reopen if this doesn't work. |
@laurenzlong thanks for support! How can I make sure my exported json file is picked up correctly? As for now I don't see any changes and |
Can you ensure that you've given the absolute path to the GOOGLE_APPLICATION_CREDENTIALS environment variable? Can you also try printing out process.env.GOOGLE_APPLICATION_CREDENTIALS to ensure that the environment variable has been set properly? |
@laurenzlong yep, everything looks good. Few more things:
|
@laurenzlong I've tried to debug token auth flow logic with no luck. Only thing I can assume is that it trying to read |
Hey @sergeybekrin, are you making any API requests within your functions? As well, can you try again but remove the "--token $FIREBASE_TOKEN" flag? And do you see the same error if you run firebase serve with just hosting and not functions? |
@laurenzlong behaviour is changed after I updated deps and used
|
Hey @sergeybekrin the behavior is extremely bizarre and I'm out of ideas. Could you try writing unit tests instead of using firebase serve inside Travis? Here's a guide on how to do it: https://firebase.google.com/docs/functions/unit-testing Please do let me know if you do end up figuring this out. I'd be very curious about what works. Sorry I can't be more helpful! You can also try posting a question to Stack Overflow and see if anybody else has figured it out. |
Actually I'll leave the issue open in case anybody else wants to jump in. |
@laurenzlong thanks, this is definitely pretty weird issue. I'll update this discussion if I came up with something. |
Having the same issue trying to use
|
This is when using either --token $FIREBASE_TOKEN or the env variable FIREBASE_TOKEN. |
I tried v3.9.1 and had the same error, but it does work fine with v3.9.0. |
Same problem here.. it works when using serve hosting but fails when serving functions |
Hi. I get the same error when I tried to run serve functions in a docker image. Looks like the problem is the empty configstore. The auth does not set the token from the cli parameters because this line never executed: So when |
Hey, @laurenzlong! Any news about this issue? It prevents us from running integration tests for Firebase Functions on CI which is very frustrating! I would be glad to help with PR, but I can't figure out how to properly pass the token to the auth module. I can't use |
having the same problem :( |
@laurenzlong My particular use case is to simply run |
yarn run v1.5.1
$ firebase serve --only functions -p 5000 --token <FIREBASE_TOKEN>
=== Serving from '/<DIRECTORY_NAME>'...
i functions: Preparing to emulate functions.
Error: An unexpected error has occurred.
error An unexpected error occurred: "Command failed.
Exit code: 2
Command: sh
Arguments: -c firebase serve --only functions -p 5000 --token <FIREBASE_TOKEN>
Directory: /<DIRECTORY_NAME>
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/<DIRECTORY_NAME>/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
$ yarn firebase serve --only hosting -p 8000 --token $FIREBASE_TOKEN "scripts": {
// ...
"firebase": "firebase",
// ...
}, $ yarn firebase serve --only functions --port 5000 --token $FIREBASE_TOKEN yarn run v1.6.0
$ firebase serve --only functions --port 5000 --token $FIREBASE_TOKEN
=== Serving from '/Vue-Fullstack-Starter'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v8.11.3 but Google Cloud Functions only supports v6.11.5.
error: /Vue-Fullstack-Starter/node_modules/firebase-admin/lib/auth/credential.js:94
throw new error_1.FirebaseAppError(error_1.AppErrorCodes.INVALID_CREDENTIAL, 'Failed to parse refresh token file: ' + error);
^
Error: Failed to parse refresh token file: Error: Refresh token must contain a "refresh_token" property. |
@laurenzlong I am working on an integration test for callable HTTPS function. AFAIK, the firebase-functions-test module is not (yet) compatible with callable https functions. Can you confirm? For that reason, I too am running the functions emulator inside a dockerized environment in our CI/CD pipeline. Updating to the latest release made it work, but I'm wondering if this is generally a bad idea? Thanks for your time! |
Hey @codyzu, yes support for callable functions in firebase-functions-test is coming, thanks for your patience. Running the emulator in a dockerized environment isn't generally a bad idea. The only trade off is that it's slower than running unit tests written with firebase-functions-test. |
Hello, I do not know if this is related but I am unable to get Basically no matter what I do,
Is this related? kubernetes/kubernetes#8512 |
@lukepighetti I'm not an expert on firebase-admin, I suggest looking through the issues in that Github repo, and filing a new one if it doesn't exist yet: https://github.com/firebase/firebase-admin-node |
Hi Lauren, forgot to follow up. I found the solution to my problem, it was a typo when initializing admin. Thanks for the quick reply! |
Thanks for the update! |
Hey there! I'm trying to run
firebase serve
on Travis CI to run smoke tests. App fails to start withError: An unexpected error has occurred.
:firebase serve --debug --only functions,hosting --token $FIREBASE_TOKEN --project $FIREBASE_PROJECT
to run itsudo: required
in Travis configVersions:
Any ideas?
The text was updated successfully, but these errors were encountered: