Open davidwallen opened 5 years ago
I'm having exact the same problem after a nvm and node upgrading and reinstalled firebase-tools.
@davidwallen have you solved it?
I had the same earlier today. I solved it by some combination of reinstalling the gcloud sdk, upgrading node, and accepting a pop-up from Mac granting network access to Node (they happened at approximately the same time, so I wasn’t able to narrow it down)
1.0.0-beta.6.0 released before couple hours ago. after that could not deploy a function to my local project. https://www.npmjs.com/package/@google-cloud/functions-emulator/v/1.0.0-beta.6.0
In workaround I've fixed the issue can not launch functions-emulaor from firebase-tools as bellow:
npx functions stop
rm -rf ./node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator
npm i "@google-cloud/functions-emulator"@"1.0.0-beta.5
npx firebase functions:shell
thanks @laiso, I hope google finds a way to solve this
@laiso pointed me to the right direction but in my case I had to downgrade a version lower than him. Downgraded to @google-cloud/functions-emulator"@1.0.0-beta.4 and after solving another, unrelated error, it worked.
If you downgrade to beta.4 and encounter the "_RangeError [ERR_OUT_OFRANGE]: The value of "value" is out of range. " error, I got it to work applying this hack: Issue #770
@laiso recommendation fixed it for me too, but i had to run it in my global npm repository ! :)
OK. I was able to reproduce this error by following the quickstart in the README.md
. I'm not sure of the issue, but I'm guessing there's a problem with the Google API Client dependency.
Was using firebase-tools@6.6.0 but got the same issue with older verions solved this using:
NODEV="$(node -v)" && rm -rf ~/.nvm/versions/node/$NODEV/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator
npm i -g @google-cloud/functions-emulator@1.0.0-beta.4
NODEV="$(node -v)" && cp -R ~/.nvm/versions/node/$NODEV/lib/node_modules/@google-cloud/functions-emulator ~/.nvm/versions/node/$NODEV/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator
1.0.0-beta.6
has been unpublished.
Can you try installing the Firebase CLI an trying again for that issue?
Note that this issue still exists with this GitHub repo.
@grant I can confirm it works now.
[2019-04-17T19:22:54.820Z] ----------------------------------------------------------------------
[2019-04-17T19:22:54.824Z] Command: /home/bluet/.nvm/versions/node/v10.15.0/bin/node /home/bluet/.nvm/versions/node/v10.15.0/bin/firebase serve --debug
[2019-04-17T19:22:54.825Z] CLI Version: 6.6.0
[2019-04-17T19:22:54.825Z] Platform: linux
[2019-04-17T19:22:54.825Z] Node Version: v10.15.0
[2019-04-17T19:22:54.825Z] Time: Thu Apr 18 2019 03:22:54 GMT+0800 (GMT+08:00)
[2019-04-17T19:22:54.826Z] ----------------------------------------------------------------------
Though not sure why it stuck at Parsing function triggers
for several minutes every time I run firebase server --debug
command. This didn't happen utill yesterday I did npm upgrade.
[2019-04-17T20:11:10.027Z] ---------------------------------------------------------------------- [2019-04-17T20:11:10.043Z] Command: C:\Program Files\nodejs\node.exe C:\Users\Luke\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js functions:shell --debug [2019-04-17T20:11:10.043Z] CLI Version: 6.6.0 [2019-04-17T20:11:10.043Z] Platform: win32 [2019-04-17T20:11:10.043Z] Node Version: v8.11.2 [2019-04-17T20:11:10.043Z] Time: Wed Apr 17 2019 13:11:10 GMT-0700 (Pacific Daylight Time) [2019-04-17T20:11:10.043Z] ---------------------------------------------------------------------- .. .. [2019-04-17T20:11:14.378Z] Error while deploying to emulator: TypeError: google.discoverAPI is not a function TypeError: google.discoverAPI is not a function
@LVeach did you uninstall and install firebase-tools again in the past 2 hours? If not, please try it, as @grant mentioned in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-484225232 that he unpublished the latest (beta 6, w/ bug) version so you'll have the stable one back now.
@BlueT I thought I had, but I will attempt those steps again!
@LVeach if you still have the same issue, please paste your steps and the output of functions start
debug info, so they can help you further. :-)
@BlueT Absolutely, I am currently doing a clean install and then will re-apply the steps above and see where it's at
@BlueT @grant : blowing away my global yarn cache along with the above steps got me back in business, thank you very much for the pointers in this thread!
Same issue with latest commit.
On one side we need node 8 to get async/await in our functions code and on the other we cant use node 8 on GoogleCloudPlatform/cloud-functions-emulator
.
@coulix My projects use node 8 and node 10 in local test environments and they work fine, so don't worry. :smiley:
At the time you post comment, the latest commit is https://github.com/GoogleCloudPlatform/cloud-functions-emulator/commit/098e253188d8caa706da08350483468d60f0c049, which is before the problem get solved.
As mentioned in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-484225232 , DON'T use latest commit on github. Instead, please use npm to install it.
And as mentioned in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-484272701 , please uninstall and reinstall.
@BlueT I am trying
nvm current v8.16.0
npx functions --version 1.0.0-beta.5
I used yarn install git://github.com/GoogleCloudPlatform/cloud-functions-emulator.git
i functions: Preparing to emulate functions.
i hosting: Serving hosting files from: prod/client
✔ hosting: Local server: http://localhost:3000
⚠ functions: Failed to emulate nuxtssr
⚠ functions: Failed to emulate func
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
^CShutting down...
~/code/perso/nuxt2-ssr-firebase feature/test ● ? npx functions start SIGINT(2) ↵ 10032 21:27:04
Google Cloud Functions Emulator RUNNING
ERROR: TypeError: google.discoverAPI is not a function
at Promise (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:112:14)
at new Promise (<anonymous>)
at RestClient.getService (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:104:12)
at RestClient._action (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:31:17)
at RestClient.listFunctions (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:145:17)
at Controller.list (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/cli/controller.js:521:24)
at controller.doIfRunning.then (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/cli/commands/list.js:72:28)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)````
@BlueT I am trying
nvm current v8.16.0
npx functions --version 1.0.0-beta.5
I used yarn install git://github.com/GoogleCloudPlatform/cloud-functions-emulator.git
i functions: Preparing to emulate functions.
i hosting: Serving hosting files from: prod/client
✔ hosting: Local server: http://localhost:3000
⚠ functions: Failed to emulate nuxtssr
⚠ functions: Failed to emulate func
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
^CShutting down...
~/code/perso/nuxt2-ssr-firebase feature/test ● ? npx functions start SIGINT(2) ↵ 10032 21:27:04
Google Cloud Functions Emulator RUNNING
ERROR: TypeError: google.discoverAPI is not a function
at Promise (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:112:14)
at new Promise (<anonymous>)
at RestClient.getService (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:104:12)
at RestClient._action (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:31:17)
at RestClient.listFunctions (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:145:17)
at Controller.list (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/cli/controller.js:521:24)
at controller.doIfRunning.then (/Users/greg/code/perso/nuxt2-ssr-firebase/node_modules/@google-cloud/functions-emulator/src/cli/commands/list.js:72:28)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)````
@coulix did you try npm i @google-cloud/functions-emulator@1.0.0-beta.5
?
AFAIK, and as replied in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-484962520 and other comments listed in that comment, DON'T install from this git repo directly until @grant has further fixes.
@grant I noticed that 1.0.0-beta.6
is listing on npm again since a day ago, but I can't see any fix. Did you intend to publish the same buggy version or by mistake?
The beta 6 update just removes the Node 6 warning so the Firebase CLI won't show the warning either. This was a request by the Firebase CLI team.
Ok I did functions stop, uninstall then installed the pinned beta.5 branch. I am making progress.
i functions: Preparing to emulate functions.
i hosting: Serving hosting files from: prod/client
✔ hosting: Local server: http://localhost:3000
⚠ functions: Failed to emulate nuxtssr
⚠ functions: Failed to emulate func
error: {
code: 404,
status: "NOT_FOUND",
message: "Function nuxtssr in location us-central1 in project nuxt-test-96b4a does not exist",
errors: [
"Function nuxtssr in location us-central1 in project nuxt-test-96b4a does not exist"
]
}
}
@coulix can you provide a demo repo to reproduce your issue? I think that would help people on investigating where the problem is.
I have it here https://github.com/coulix/nuxt2-ssr-firebase
yarn setup
yarn serve
https://nuxt-test-96b4a.firebaseapp.com/
Renderer is loaded but not all resources are unavailable! Please check /srv/nuxt/dist/server existence.
@coulix I've checked the repo you provide and followed your steps, it installed 1.0.0-beta.6.
You can check it by $ cat node_modules/@google-cloud/functions-emulator/package.json |grep version
which shows "version": "1.0.0-beta.6",
.
The reason is, you specified version ^1.0.0-beta.5
, which the ^ will install latest compatible version of @google-cloud/functions-emulator.
"dependencies": {
"@google-cloud/functions-emulator": "^1.0.0-beta.5"
}
And due to @grant published broken version 1.0.0-beta.6 again (mentioned in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-485050265 and https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-485053860), you will get the broken 1.0.0-beta.6 installed in your system.
After npm i @google-cloud/functions-emulator@1.0.0-beta.5
and those setup processes, I can get it running.
bluet@Zorya:~/workspace/tmp/nuxt2-ssr-firebase$ NODE_ENV=development firebase serve --only functions,hosting -p 3000 --project test-cf2e8
=== Serving from '/home/bluet/workspace/tmp/nuxt2-ssr-firebase'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.15.3 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: prod/client
✔ hosting: Local server: http://localhost:3000
✔ functions: nuxtssr: http://localhost:3001/test-cf2e8/us-central1/nuxtssr
✔ functions: func: http://localhost:3001/test-cf2e8/us-central1/func
And these messages showed when requesting http://localhost:3000/ doesn't belong to cloud-functions-emulator. You should check your nuxt2 project itself.
[hosting] Rewriting / to local function nuxtssr
info: User function triggered, starting execution
info: IN New Nuxt Trial:
error:
03:13:59 ERROR Renderer is loaded but not all resources are unavailable! Please check /home/bluet/workspace/tmp/nuxt2-ssr-firebase/prod/server/nuxt/dist/server existence.
at VueRenderer.renderRoute (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:2817:19)
at Server.renderRoute (node_modules/@nuxt/server/dist/server.js:811:38)
at nuxtMiddleware (node_modules/@nuxt/server/dist/server.js:124:26)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at servePlaceholderMiddleware (node_modules/serve-placeholder/src/index.js:29:16)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at node_modules/@nuxt/server/dist/server.js:555:5
info: Execution took 23 ms, user function completed successfully
127.0.0.1 - - [23/Apr/2019:19:13:59 +0000] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/73.0.3683.86 Chrome/73.0.3683.86 Safari/537.36"
Because I didn't see anything in that folder.
$ LC_ALL=C ls /home/bluet/workspace/tmp/nuxt2-ssr-firebase/prod/server/nuxt/dist/server
ls: cannot access '/home/bluet/workspace/tmp/nuxt2-ssr-firebase/prod/server/nuxt/dist/server': No such file or directory
I just realized that what mentioned in https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues/321#issuecomment-485053860 is that the new beta.6 doesn't break things. So it's ok to have beta.6 installed. Sorry for misunderstanding you @grant
@coulix I've tested your repo and it seems to be problems with your nuxt project itself.
@BlueT Thank you so much for the investigation! I will pursue this bug onto Nuxt then.
I'm using beta 6 and have the same error by running yarn serve
, which is a composition of npm run build && firebase serve --only functions
.
Running those 2 commands separately works.
Hi! I try to debug firestore functions locally and get the same error. (use nvm, windows 10 and example functions "makeUppercase").
`firebase --debug functions:shell [2019-04-26T08:41:30.933Z] ---------------------------------------------------------------------- [2019-04-26T08:41:30.937Z] Command: C:\Program Files\nodejsnvm\node.exe C:\Users\briza\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js --debug functions:shell [2019-04-26T08:41:30.938Z] CLI Version: 6.6.0 [2019-04-26T08:41:30.938Z] Platform: win32 [2019-04-26T08:41:30.938Z] Node Version: v8.16.0 [2019-04-26T08:41:30.939Z] Time: Fri Apr 26 2019 11:41:30 GMT+0300 (Russia TZ 2 Standard Time) [2019-04-26T08:41:30.939Z] ----------------------------------------------------------------------
[2019-04-26T08:41:30.950Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2019-04-26T08:41:30.951Z] > authorizing via signed-in user
...
[2019-04-26T08:41:34.891Z] Starting @google-cloud/functions-emulator
[2019-04-26T08:41:34.936Z] Parsing function triggers
[2019-04-26T08:41:35.279Z] Deploying functions locally
[2019-04-26T08:41:35.287Z] Error while deploying to emulator: TypeError: google.discoverAPI is not a function
TypeError: google.discoverAPI is not a function
at Promise (C:\Users\briza\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\@google-cloud\functions-emulator\src\client\rest-client.js:112:14)
at new Promise (
@alex89607 seems like you're not using the latest beta.6 but the previous beta.6.
Please try to clean your package caches and install from npmjs again.
Host: Pixelbook Slate i7 16 GB Host OS: Google Chrome OS Version 72.0.3626.122 (Official Build) (64-bit) Container OS: Linux penguin 4.19.4-02480-gd44d301822f0 #1 SMP PREEMPT Thu Dec 6 17:45:27 PST 2018 x86_64 GNU/Linux Virtual machine info:
node --version: v8.15.1 npm --version: 6.4.1 functions --version: 1.0.0-beta.5 reproduced by: user:~/cloud-functions-emulator$ functions start output: