firebase-tools: 7.0.2
Platform: macOS
npm i -g firebase-tools@latest
or
npm i -D firebase-tools@latest
Error encountered: TypeError: _onRequestWithOpts is not a function at Object.httpsProvider._onRequestWithOpts (in lib/emulator/functionsEmulatorRuntime.js)
1) Init a new project with Firebase init, choose location, and set up functions in the dashboard
2) Updated global package, ran firebase run serve
, and encountered the error
3) Deleted the global package, installed locally to project, ran firebase run serve
, and encountered the error
4) Console logged const httpsProvider = require(httpsProviderResolution);
in the above file and the path outputted is lib/providers/https
which does not exist.
(Note: Functions local emulator worked prior to step #2 when I tried to update firebase-tools.)
Run functions locally.
functions: Emulator started at http://localhost:5000
i functions: Watching "/Users/joe/Server/my-project/functions" for Cloud Functions...
⚠ TypeError: _onRequestWithOpts is not a function
at Object.httpsProvider._onRequestWithOpts (/Users/joe/Server/my-project/functions/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:278:24)
at Object.httpsProvider.onRequest (/Users/joe/Server/my-project/functions/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:283:34)
at Object.
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at /Users/joe/Server/my-project/functions/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:582:33
⚠ We were unable to load your functions code. (see above)
Experiencing the exact same issue. All was well day before yesterday. Thanks for posting this - I've been racking my brains trying to figure out what I've done wrong that would have broken my little project. Tried reverting to version 7.0.0 of firebase-tools but still got the same error. firebase deploy
seems to work fine; it's firebase serve
that gives the error.
I've opened a PR to fix it, see #1482.
I'm also running into this issue.
Literally having the same issue. Tried just running the hello world program and gives the same error if using firebase serve. Good to know I'm not the only one.
Thanks all for reporting and @merlinnot for the fix! That's what we get for relying on internal APIs
anyone else getting an unexpected error, when trying to run firebase serve with the hello world program?
Yes @mmillerscsu . First got this error last night. Was working on an existing project, so my first thought was: I screwed up something. A few hours later, I decided to create a project from scratch and that's when I noticed that even the helloWorld function on a brand new project gives the same errror on trying to run firebase serve
. Then this morning I saw this thread.
If you are experiencing this issue, the workaround is to run npm install [email protected]
in your functions
directory.
Thanks @samtstern Any ETA on when this will be fixed though?
If anyone needs a quick fix for this issue, I just tried workaround suggested by @samtstern and firebase serve
now works fine. Thanks again @samtstern
@samtstern got it to work thanks! I will be using this temporarily until they update the fix.
@lcarbonaro did you run firebase init first, and then firebase-functions?
@mmillerscsu No I just ran npm install [email protected]
in the functions folder as @samtstern suggested.
@lcarbonaro got it to work now thanks.
Thanks @samtstern for the workaround, that helped me.
I tried installing 3.0.2
& firebase/firebase-functions#master
(per the ref'd merged PR), and still getting that error in both cases. Maybe another dep in the mix causing issues? I'm:
"actions-on-google": "^2.8.0",
"firebase-admin": "^8.2.0",
"firebase-functions": "3.0.2",
"firebase-functions-test": "^0.1.6",
@lefnire Same error message? I have the same dependencies on my functions package.json but the only error that I got it was from grpc that made me update the node version to 10.
@jheredia scratch that, I nuked node_modules & functions/node_modules tried again, all good
Delete node_modules then run npm install, npm install firebase-admin and npm install [email protected]
npm install [email protected]
(not 3.0.2) worked for me
This has been fixed in firebase-tools 7.1.0
On Fri, Jul 12, 2019, 7:08 AM João Paulo Vanzuita notifications@github.com
wrote:
npm install [email protected] (not 3.0.2) worked for me
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/1480?email_source=notifications&email_token=ACATB2R35JKIGQQKMZCMEF3P7CF67A5CNFSM4H7AWTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZ3QRQ#issuecomment-510900294,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACATB2XJ6OQPGPUHO65FVADP7CF67ANCNFSM4H7AWTVQ
.
no it hasnt been fixed
Fixed it for me when i run npm install [email protected]
inside functions
as described in this stackoverflow answer
npm install [email protected]
fixed it for me
Use node ver 8 fixed for me ;)
This appears to be working for me in [email protected]
got the same issue. @samtstern Is there any chance to see it fixed soon?
@hyzhak this should be fixed in the latest release of firebase-tools
. If you're having issues still, can you open a new issue with the appropriate information so we can better track it? thanks.
For those running WSL 1 (linux on Windows 10), using firebase tools 7.10 or 7.2.2 to fix this issue might still be a problem, due to something in 7.10 causing a problem for WSL users: #1458.
I run WSL 1 with firebase tools 7.0.2, node 10, and installing [email protected] fixed this problem for me.
For me it was because firebase-tools was installed globally after upgrading to latest.
npm uninstall -g firebase-tools
then update your scripts to to use npx equivalent commands.
npx -p firebase-tools serve
https://twitter.com/leblancmeneses/status/1159349938331029504
Still with the same problemn, solved with [email protected]
Worked with me:
here is what worked for me yesterday
1. npm i firebase-functions@latest
2. npm i -g firebase-tools@latest
3. close and open the command line
Fixed in 4.15.1
Most helpful comment
If you are experiencing this issue, the workaround is to run
npm install [email protected]
in yourfunctions
directory.