TypeError: _onRequestWithOpts не является функцией в Object.httpsProvider._onRequestWithOpts - PullRequest
1 голос
/ 09 июля 2019

Я создаю приложение, которое использует firebase-функции.Я создал каталог приложения и запустил firebase init.После того, как это было завершено, я попытался запустить программу hello world, которая дает вам использование firebase serve, и я получаю эту ошибку:

TypeError: _onRequestWithOpts is not a function
at Object.httpsProvider._onRequestWithOpts

, как это выглядит, похоже, проблема с onRequest(), но я уже делал приложения, использующие это раньше, и никогда не сталкивался с этой проблемой.Я буквально не изменил ни одного куска кода, который они вам первоначально дали, поэтому, если они не решили что-то изменить в одночасье, я не уверен, в чем проблема.,Используя экспресс и добавление новых функций, ошибка появляется при запуске firebase deploy и serve.

const functions = require('firebase-functions');

// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase- 
functions
//
exports.helloWorld = functions.https.onRequest((request, response) 
=> {
response.send("Hello from Firebase!");
});

    Gabriels-MacBook-Pro:functions Mike$ firebase serve

    === Serving from '/Users/Gabe/Desktop/mycart-functions'...

   ⚠  Your requested "node" version "8" doesn't match your global 
    version "10"
    ✔  functions: Emulator started at http://localhost:5000
    i  functions: Watching "/Users/Gabe/Desktop/mycart- 
   functions/functions" for Cloud Functions...
   ⚠  TypeError: _onRequestWithOpts is not a function
    at Object.httpsProvider._onRequestWithOpts 
   (/usr/local/lib/node_modules/firebase- 
  tools/lib/emulator/functionsEmulatorRuntime.js:278:24)
    at Object.httpsProvider.onRequest 
   (/usr/local/lib/node_modules/firebase- 
  tools/lib/emulator/functionsEmulatorRuntime.js:283:34)
    at Object.<anonymous> (/Users/Gabe/Desktop/mycart- 
   functions/functions/index.js:6:39)
    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:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
   ⚠  We were unable to load your functions code. (see above)
...