vscode-azurefunctions: Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:5858)
I’m facing a weird issue.
Error:
Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:5858).
VSCode 1.23.1
MacOS
Node: 10.1.0
OS: macOS Sierra
npm: 6.0.1
Chrome: 66.0.3359.181
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to JavaScript Functions",
"type": "node",
"request": "attach",
"port": 5858,
"protocol": "inspector",
"preLaunchTask": "runFunctionsHost"
}
]
}
Trying to create an Azure function.
Several errors in my terminal output:
> Executing task: func host start <
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
Hosting environment: Production
Content root path: /Users/$USER/Documents/Web/Sandbox/afn
Now listening on: http://localhost:7071
Application started. Press Ctrl+C to shut down.
[5/19/18 8:24:57 PM] Reading host configuration file '/Users/$USER/Documents/Web/Sandbox/afn/host.json'
[5/19/18 8:24:57 PM] Host configuration file read:
[5/19/18 8:24:57 PM] {}
[5/19/18 8:24:57 PM] Starting Host (HostId=ahmadsmacbookpro-763423413, InstanceId=50434726-525b-4afa-9566-a137447a193f, Version=2.0.11651.0, ProcessId=98058, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
[5/19/18 8:24:57 PM] Unable to configure java worker. Could not find JAVA_HOME app setting.
[5/19/18 8:24:57 PM]
[5/19/18 8:24:57 PM] Could not configure language worker Java.
[5/19/18 8:24:57 PM]
[5/19/18 8:24:57 PM] Start Process: node --inspect=5858 "/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 55405 --workerId 33587250-9112-4a07-a373-8572a42396da --requestId 53993c42-bc16-4358-ab64-074a66876e11
[5/19/18 8:24:57 PM] Debugger listening on port 5858.
[5/19/18 8:24:57 PM] Warning: This is an experimental feature and could change at any time.
[5/19/18 8:24:57 PM] To start debugging, open the following URL in Chrome:
[5/19/18 8:24:57 PM] chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5858/a514a2fa-8b05-47f9-b371-79afd68b44c5
[5/19/18 8:24:57 PM] Generating 1 job function(s)
[5/19/18 8:24:57 PM] Found the following functions:
[5/19/18 8:24:57 PM] Host.Functions.HttpTriggerJS
[5/19/18 8:24:57 PM]
[5/19/18 8:24:57 PM] Host initialized (656ms)
[5/19/18 8:24:57 PM] azure-functions-nodejs-worker officially supports node version >=8.4.0. Current version v7.10.0.
[5/19/18 8:24:57 PM] To install required native modules for v7.10.0, install node-pre-gyp via 'npm i -g node-pre-gyp'.
[5/19/18 8:24:57 PM] Navigate to '<node-worker-dir>/grpc' and run 'node-pre-gyp install'
[5/19/18 8:24:57 PM] Host started (687ms)
[5/19/18 8:24:57 PM] Job host started
[5/19/18 8:24:57 PM] Couldn't require bundle, falling back to Worker.js. Error: Cannot find module '/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/grpc/src/node/extension_binary/node-v51-darwin-x64/grpc_node.node'
[5/19/18 8:24:57 PM] module.js:472
[5/19/18 8:24:57 PM] throw err;
[5/19/18 8:24:57 PM] ^
[5/19/18 8:24:57 PM] Error: Cannot find module './Worker.js'
[5/19/18 8:24:57 PM] at Function.Module._resolveFilename (module.js:470:15)
[5/19/18 8:24:57 PM] at Function.Module._load (module.js:418:25)
[5/19/18 8:24:57 PM] at Module.require (module.js:498:17)
[5/19/18 8:24:57 PM] at require (internal/module.js:20:19)
[5/19/18 8:24:57 PM] at Object.<anonymous> (/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js:8:14)
[5/19/18 8:24:57 PM] at Module._compile (module.js:571:32)
[5/19/18 8:24:57 PM] at Object.Module._extensions..js (module.js:580:10)
[5/19/18 8:24:57 PM] at Module.load (module.js:488:32)
[5/19/18 8:24:57 PM] at tryModuleLoad (module.js:447:12)
[5/19/18 8:24:57 PM] at Function.Module._load (module.js:439:3)
[5/19/18 8:24:57 PM] Worker encountered an error.
[5/19/18 8:24:57 PM] Worker process with pid 98060 exited with code 1.
[5/19/18 8:24:57 PM] Start Process: node --inspect=5858 "/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 55405 --workerId fa3f45e4-eb03-424a-903f-e3e25ee692ad --requestId e3ec9f82-c612-4706-be84-aff784a88ff4
[5/19/18 8:24:57 PM] Debugger listening on port 5858.
[5/19/18 8:24:57 PM] Warning: This is an experimental feature and could change at any time.
[5/19/18 8:24:57 PM] To start debugging, open the following URL in Chrome:
[5/19/18 8:24:57 PM] chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5858/XXXXX-0e65-47d6-b569-63693636c245
Listening on http://localhost:7071/
Hit CTRL-C to exit...
Http Functions:
HttpTriggerJS: http://localhost:7071/api/HttpTriggerJS
[5/19/18 8:24:57 PM] azure-functions-nodejs-worker officially supports node version >=8.4.0. Current version v7.10.0.
[5/19/18 8:24:57 PM] To install required native modules for v7.10.0, install node-pre-gyp via 'npm i -g node-pre-gyp'.
[5/19/18 8:24:57 PM] Navigate to '<node-worker-dir>/grpc' and run 'node-pre-gyp install'
[5/19/18 8:24:58 PM] Couldn't require bundle, falling back to Worker.js. Error: Cannot find module '/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/grpc/src/node/extension_binary/node-v51-darwin-x64/grpc_node.node'
[5/19/18 8:24:58 PM] module.js:472
[5/19/18 8:24:58 PM] throw err;
[5/19/18 8:24:58 PM] ^
[5/19/18 8:24:58 PM] Error: Cannot find module './Worker.js'
[5/19/18 8:24:58 PM] at Function.Module._resolveFilename (module.js:470:15)
[5/19/18 8:24:58 PM] at Function.Module._load (module.js:418:25)
[5/19/18 8:24:58 PM] at Module.require (module.js:498:17)
[5/19/18 8:24:58 PM] at require (internal/module.js:20:19)
[5/19/18 8:24:58 PM] at Object.<anonymous> (/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js:8:14)
[5/19/18 8:24:58 PM] at Module._compile (module.js:571:32)
[5/19/18 8:24:58 PM] at Object.Module._extensions..js (module.js:580:10)
[5/19/18 8:24:58 PM] at Module.load (module.js:488:32)
[5/19/18 8:24:58 PM] at tryModuleLoad (module.js:447:12)
[5/19/18 8:24:58 PM] at Function.Module._load (module.js:439:3)
[5/19/18 8:24:58 PM] Worker encountered an error.
[5/19/18 8:24:58 PM] Worker process with pid 98062 exited with code 1.
[5/19/18 8:24:58 PM] Start Process: node --inspect=5858 "/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 55405 --workerId e50dd0da-8419-49b8-8a25-87520752a694 --requestId 71f7ab6c-a836-4d57-b0f8-8f9d541f6b4d
[5/19/18 8:24:58 PM] Debugger listening on port 5858.
[5/19/18 8:24:58 PM] Warning: This is an experimental feature and could change at any time.
[5/19/18 8:24:58 PM] To start debugging, open the following URL in Chrome:
[5/19/18 8:24:58 PM] chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5858/as-631d-4dfe-b7da-7e9ccf4379e9
[5/19/18 8:24:58 PM] azure-functions-nodejs-worker officially supports node version >=8.4.0. Current version v7.10.0.
[5/19/18 8:24:58 PM] To install required native modules for v7.10.0, install node-pre-gyp via 'npm i -g node-pre-gyp'.
[5/19/18 8:24:58 PM] Navigate to '<node-worker-dir>/grpc' and run 'node-pre-gyp install'
[5/19/18 8:24:58 PM] Couldn't require bundle, falling back to Worker.js. Error: Cannot find module '/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/grpc/src/node/extension_binary/node-v51-darwin-x64/grpc_node.node'
[5/19/18 8:24:58 PM] module.js:472
[5/19/18 8:24:58 PM] throw err;
[5/19/18 8:24:58 PM] ^
[5/19/18 8:24:58 PM] Error: Cannot find module './Worker.js'
[5/19/18 8:24:58 PM] at Function.Module._resolveFilename (module.js:470:15)
[5/19/18 8:24:58 PM] at Function.Module._load (module.js:418:25)
[5/19/18 8:24:58 PM] at Module.require (module.js:498:17)
[5/19/18 8:24:58 PM] at require (internal/module.js:20:19)
[5/19/18 8:24:58 PM] at Object.<anonymous> (/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.25/workers/node/dist/src/nodejsWorker.js:8:14)
[5/19/18 8:24:58 PM] at Module._compile (module.js:571:32)
[5/19/18 8:24:58 PM] at Object.Module._extensions..js (module.js:580:10)
[5/19/18 8:24:58 PM] at Module.load (module.js:488:32)
[5/19/18 8:24:58 PM] at tryModuleLoad (module.js:447:12)
[5/19/18 8:24:58 PM] at Function.Module._load (module.js:439:3)
[5/19/18 8:24:58 PM] Worker encountered an error.
[5/19/18 8:24:58 PM] Worker process with pid 98063 exited with code 1.
Help.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 34 (13 by maintainers)
NOTE: When running on a non-Windows machine, the environment name should be
workers__node__Debug
. This is case sensitive, so the capitalD
is important.I’m on node v8.6. It seems like ‘–inspect=5858’ isn’t being passed in to the node process like it used to be.
This is what I see in the log for .25:
This is what I see in the log for .26:
@ahmadawais - This line in your error log shows that VS Code thinks your version of node is an unsupported older version (I think).
I was experiencing a similar issue with VS Code thinking I was using v10.x of node. I found that it is due to how nvm interacts with shell environments and how VS Code loads the node version based on what is aliased as the
default
. See this SO Q&A for more info: Visual Studio Code to use node version specified by NVMThe only suggested solution that worked for me was to set
nvm alias default 8.11.2
in the terminal and restart VS Code. Not my preferred choice, but it works. You need to set your default alias to something in the v8.x range. It doesn’t look like extension binaries are available for later versions of node.NOTE: Setting the
runtimeExecutable
attribute inlaunch.json
, for the debugger, will not work due to it only being available for request types oflaunch
, notattach
. See: Launch configuration attributes@EricJizbaMSFT and @pragnagopa would making the
runtimeExecutable
attribute available for request types ofattach
be feasible? I would much rather set that in the config than muck with my nvm default.@ahmadawais I’ll echo what @pragnagopa said. There were two issues here - one directly related to VS Code (which was fixed) and one specific to the azure-functions-nodejs-worker. I don’t think there’s anything we could do from the VS Code side to fix your issue and I recommend investigating it further in the repo she mentioned: https://github.com/Azure/azure-functions-nodejs-worker
@EricJizbaMSFT I can confirm that it’s still not working for me on MacOS. 😦
I ran
OUTPUT
When I create an Azure function, let’s say HTTP triggered JavaScript based function. And press play in the debug the following is what I get as output in my terminal.
TERMINAL OUTPUT (CLICK TO EXPAND!)
And the same error
Help.
Closing this issue as it has been fixed in the latest version of the func cli. The workarounds mentioned above are no longer necessary - simply update your func cli:
or
It looks like this PR introduced a change in the way we check for debug port: https://github.com/Azure/azure-functions-host/commit/980107fb13e18f75be545948ede20933ea93a590.
It seems like the issue may be more fundamental though, as adding the additional environment variable (see snippet below) which sets the --inspect param correctly does not attach a debugger correctly.
"options": { "env": { "workers:node:debug": "5858" } }
==CORRECTION: adding this does work==
I’m filing an issue for this against the runtime, cc @pragnagopa