foreversd/forever

How to use locally with --inspect

Opened this issue · 3 comments

How do I do something like this in my npm scripts

"debug": "forever start --inspect node_modules/@google-cloud/functions-framework --target=api",

however it doesn't accept it with

help:    usage: forever [action] [options] SCRIPT [script-options]
help:
help:    Monitors the script specified in the current process or as a daemon
help:

ideas?

Looks like this is what I need:

"debug2": "forever -c 'node --inspect' node_modules/@google-cloud/functions-framework --target=api",

Reopening as this as errors will still shutdown node in --inspect mode:

Serving function...
Function: api
URL: http://localhost:8080/
Unhandled rejection
Error: Sorry, we cannot connect to Cloud Services without a project
 ID. You may specify one with an environment variable named
 "GOOGLE_CLOUD_PROJECT".
    at replaceProjectIdToken (/Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/projectify/build/src/index.js:45:19)
    at replaceProjectIdToken (/Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/projectify/build/src/index.js:38:30)
    at /Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/datastore/src/request.js:1139:17
    at /Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/google-auth-library/build/src/auth/googleauth.js:73:48
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Error: Process exited with code 16
    at process.<anonymous> (/Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:393:29)
    at process.emit (events.js:200:13)
    at process.EventEmitter.emit (domain.js:471:20)
    at process.exit (internal/process/per_thread.js:157:15)
    at logAndSendError (/Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:184:9)
    at process.<anonymous> (/Users/nikos/WebstormProjects/gcp-datastore-cloud-functions-realworld-example-app/node_modules/@google-cloud/functions-framework/build/src/invoker.js:390:13)
    at process.emit (events.js:200:13)
    at process.EventEmitter.emit (domain.js:471:20)
    at processPromiseRejections (internal/process/promises.js:165:18)
    at processTicksAndRejections (internal/process/task_queues.js:90:32)
Waiting for the debugger to disconnect...

I would recommend using pm2