firebase-tools: TypeError: _onRequestWithOpts is not a function
[REQUIRED] Environment info
firebase-tools: 7.0.2
Platform: macOS
[REQUIRED] Test case
npm i -g firebase-tools@latest
or
npm i -D firebase-tools@latest
[REQUIRED] Steps to reproduce
Error encountered: TypeError: _onRequestWithOpts is not a function at Object.httpsProvider._onRequestWithOpts (in lib/emulator/functionsEmulatorRuntime.js)
- Init a new project with Firebase init, choose location, and set up functions in the dashboard
- Updated global package, ran
firebase run serve
, and encountered the error - Deleted the global package, installed locally to project, ran
firebase run serve
, and encountered the error - Console logged
const httpsProvider = require(httpsProviderResolution);
in the above file and the path outputted islib/providers/https
which does not exist.
(Note: Functions local emulator worked prior to step #2 when I tried to update firebase-tools.)
[REQUIRED] Expected behavior
Run functions locally.
[REQUIRED] Actual behavior
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.<anonymous> (/Users/joe/Server/my-project/functions/index.js:18:38) 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)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 35 (6 by maintainers)
If you are experiencing this issue, the workaround is to run
npm install firebase-functions@3.0.2
in yourfunctions
directory.I’ve opened a PR to fix it, see #1482.
no it hasnt been fixed
@mmillerscsu No I just ran
npm install firebase-functions@3.0.2
in the functions folder as @samtstern suggested.For me it was because firebase-tools was installed globally after upgrading to latest.
then update your scripts to to use npx equivalent commands.
https://twitter.com/leblancmeneses/status/1159349938331029504
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.
Still with the same problemn, solved with firebase-functions@3.0.2
@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.This appears to be working for me in
firebase-tools@7.1.1
npm install firebase-functions@3.0.2
fixed it for menpm install firebase-functions@3.0.1
(not 3.0.2) worked for me@jheredia scratch that, I nuked node_modules & functions/node_modules tried again, all good