Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: _onRequestWithOpts is not a function #1481

Closed
3sanket3 opened this issue Jul 9, 2019 · 2 comments
Closed

TypeError: _onRequestWithOpts is not a function #1481

3sanket3 opened this issue Jul 9, 2019 · 2 comments

Comments

@3sanket3
Copy link

3sanket3 commented Jul 9, 2019

Related issues

No

[REQUIRED] Version info

node:

v8.12.0

firebase-functions:
^3.0.0

firebase-tools:

7.0.2

firebase-admin:
^8.0.0

[REQUIRED] Test case

  1. firebase init

  2. FirebaseCLI Feature : Functions: Configure and deploy Cloud Functions
  3. Language: TypeScript
  4. cd functions

  5. Uncomment the helloWorld function from index.ts
  6. npm run serve

[REQUIRED] Steps to reproduce

Same as Test Case above

[REQUIRED] Expected behavior

The npm run serve command should run without any error

[REQUIRED] Actual behavior

[debug] [2019-07-09T05:18:30.659Z] ----------------------------------------------------------------------
[debug] [2019-07-09T05:18:30.665Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\<my-pc-username>\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js functions:shell
[debug] [2019-07-09T05:18:30.665Z] CLI Version:   7.0.2
[debug] [2019-07-09T05:18:30.665Z] Platform:      win32
[debug] [2019-07-09T05:18:30.665Z] Node Version:  v8.12.0
[debug] [2019-07-09T05:18:30.667Z] Time:          Tue Jul 09 2019 10:48:30 GMT+0530 (India Standard Time)
[debug] [2019-07-09T05:18:30.667Z] ----------------------------------------------------------------------
[debug] 
[debug] [2019-07-09T05:18:30.691Z] > 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"]
[debug] [2019-07-09T05:18:30.693Z] > authorizing via signed-in user
[debug] [2019-07-09T05:18:30.693Z] [iam] checking project <my-project-id> for permissions ["firebase.projects.get"]
[debug] [2019-07-09T05:18:30.702Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/<my-project-id>:testIamPermissions  

[debug] [2019-07-09T05:18:32.555Z] <<< HTTP RESPONSE 200
[debug] [2019-07-09T05:18:32.569Z] [functions] Using node@8 from host.
[debug] [2019-07-09T05:18:32.570Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/<my-project-id>  
 
[debug] [2019-07-09T05:18:34.162Z] <<< HTTP RESPONSE 200
[debug] [2019-07-09T05:18:34.163Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/674100845266:getServerAppConfig  
 
[debug] [2019-07-09T05:18:34.498Z] <<< HTTP RESPONSE 200
[info] +  functions: Emulator started at http://localhost:5001
[debug] [2019-07-09T05:18:34.510Z] [functions] Watching "C:\<my-project-folder>\functions" for Cloud Functions...
[debug] [2019-07-09T05:18:36.152Z] DEBUG: Functions runtime initialized.
[debug] [2019-07-09T05:18:36.154Z] DEBUG: Disabled runtime features: {"functions_config_helper":true,"network_filtering":true,"timeout":true,"memory_limiting":true,"protect_env":true,"admin_stubs":true}
[debug] [2019-07-09T05:18:36.433Z] DEBUG: firebase-admin has been stubbed.
[warn] !  TypeError: _onRequestWithOpts is not a function
    at Object.httpsProvider._onRequestWithOpts (C:\Users\<my-pc-username>\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:278:24)
    at Object.httpsProvider.onRequest (C:\Users\<my-pc-username>\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:283:34)
    at Object.<anonymous> (C:\<my-project-folder>\functions\lib\index.js:7:38)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
[warn] !  We were unable to load your functions code. (see above)
   - It appears your code is written in Typescript, which must be compiled before emulation.
   - You may be able to run "npm run build" in your functions directory to resolve this.

Were you able to successfully deploy your functions?

Yes, deployment was successful. It seems the issue is with testing locally only.

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@thechenky thechenky transferred this issue from firebase/firebase-functions Jul 9, 2019
@3sanket3
Copy link
Author

3sanket3 commented Jul 9, 2019

Closing in favor of #1480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants