TypeError: _onRequestWithOpts is not a function
See original GitHub issue[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)
Issue Analytics
- State:
- Created 4 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.