Azure-functions-host: Proxies: Worker was unable to load function: The argument 'id' must be a non-empty string.

Created on 22 Jun 2019  路  27Comments  路  Source: Azure/azure-functions-host

Error message cropped up today when locally running functions:

LanguageWorkerConsoleLog[error] Worker was unable to load function letsencrypt-proxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''

Haven't changed proxy configs in a while - appears to be either unexpected schema change or bug/regression in Azure Functions Core Tools/Function Runtime.

Removed node_modules, bin, obj, etc and did npm i. Same result.


Azure Functions Core Tools: 2.7.1373 - Commit hash: cd9bfca26f9c7fe06ce245f5bf69bc6486a685dd)
Function Runtime Version: 2.0.12507.0

proxies.json (config hasn't changed in a while)

{
  "$schema": "http://json.schemastore.org/proxies",
  "proxies": {
    "letsencrypt-proxy": {
        "matchCondition": {
            "route": "/.well-known/acme-challenge/{*restOfPath}",
            "methods": ["GET"]
        },
        "backendUri": "https://localhost/api/letsencrypt/{restOfPath}"
    }
  }
}

Most helpful comment

I shut down VS Code and manually killed two instances of Node.js. There were about 20 instances of the "Runtime Broker" process running (I had been writing code and testing for several hours) and I killed all of those. I restarted VS Code and was able to debug again. If I had to guess, I'd say there's a process leakage bug.

All 27 comments

@iyerusad Is this a proxy only function app, if you have other functions, what language are they using

No, it has over 10 Azure functions running on Node.

Having the same issue here with javascript function on Node.

@pragnagopa is this a known issue?

@mhoeger - Can you please take a look?

Having the same issue, using Node.

Was getting following error today

Exceeded language worker restart retry count for runtime:node. Shutting down Functions Host
Application is shutting down...

Updated from node 10.14.1 to 10.16.1 (latest LTS) resolved this particular issue.

Proxies issue still persists.

Similar issue. However, the error seems to be benign. The proxy seems to operate as expected in this simple case. Not sure if a more complex case would surface some issue:
image

Same problem, came out of nowhere
Also using Node
image

Seeing the same problem today when running locally in VS Code.

Azure Functions Core Tools (2.7.1575 Commit hash: b7750e771a4e56352c767dfa16413ec9c79b72ba)
Function Runtime Version: 2.0.12625.0
Node v10.15.3

Is there a workaround anyone knows about?

I shut down VS Code and manually killed two instances of Node.js. There were about 20 instances of the "Runtime Broker" process running (I had been writing code and testing for several hours) and I killed all of those. I restarted VS Code and was able to debug again. If I had to guess, I'd say there's a process leakage bug.

this is still happening as of today Nov 8, 2019

Same error here... Does however some to be working?!
(Which we realized after an hour or two, after searching for root causes).

this is still happening as of today Nov 8, 2019

Likewise for me.

Having local.settings.json included in my solution helped with the error - might be kicked off by not having "Values" or "Host" related to local.settings

Having local.settings.json included in my solution helped with the error - might be kicked off by not having "Values" or "Host" related to local.settings

Cannot confirm - get errors still with both:
image

image

Yes can confirm I see this too. @fabiocav @mhoeger @ColbyTresness it appears when using proxies in JavaScript it throws this error on func start. It does appear to be harmless in that the proxy still works locally and in cloud, but would be good to sort out.

[12/11/2019 3:39:33 PM] Worker was unable to load function loaderio: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
[12/11/2019 3:39:33 PM] Worker failed to function id 5aaa285f-06cd-4062-be4d-d27a2d4a9836.
[12/11/2019 3:39:33 PM] Result: Failure
[12/11/2019 3:39:33 PM] at Module.require (internal/modules/cjs/loader.js:689:11)
[12/11/2019 3:39:33 PM] at require (internal/modules/cjs/helpers.js:25:18)
[12/11/2019 3:39:33 PM] at FunctionLoader.load (/usr/local/Cellar/azure-functions-core-tools@3/3.0.1975/workers/node/worker-bundle.js:20050:22)
[12/11/2019 3:39:33 PM] at WorkerChannel.functionLoadRequest (/usr/local/Cellar/azure-functions-core-tools@3/3.0.1975/workers/node/worker-bundle.js:17821:38)
[12/11/2019 3:39:33 PM] at ClientDuplexStream.WorkerChannel.eventStream.on (/usr/local/Cellar/azure-functions-core-tools@3/3.0.1975/workers/node/worker-bundle.js:17738:30)
[12/11/2019 3:39:33 PM] at ClientDuplexStream.emit (events.js:198:13)
[12/11/2019 3:39:33 PM] at addChunk (_stream_readable.js:288:12)
[12/11/2019 3:39:33 PM] at readableAddChunk (_stream_readable.js:269:11)
[12/11/2019 3:39:33 PM] at ClientDuplexStream.Readable.push (_stream_readable.js:224:10)
[12/11/2019 3:39:33 PM] at Object.onReceiveMessage (/usr/local/Cellar/azure-functions-core-tools@3/3.0.1975/workers/node/worker-bundle.js:21890:19).

This happens for both v2 and v3, but my repro above was using the latest v3 core tools

I'm also getting this error with my proxies, though both the functions and proxies do still seem to work ...

{ "$schema": "http://json.schemastore.org/proxies", "proxies": { "root": { "matchCondition": { "route": "/{*path}" }, "backendUri": "https://<mysite>.z9.web.core.windows.net/index.html" }, "api": { "matchCondition": { "route": "/api/{*path}" }, "backendUri": "https://localhost/api/{path}" }, "static": { "matchCondition": { "route": "/static/{*path}" }, "backendUri": "https://<mysite>.z9.web.core.windows.net/static/{path}" }, "favicon": { "matchCondition": { "route": "/favicon.ico" }, "backendUri": "https://<mysite>.z9.web.core.windows.net/favicon.ico" } } }

Verbosity of the errors has slightly increased (looks like a deeper call stack):

Azure Functions Core Tools (2.7.2184 Commit hash: 5afacc827c2848e4debc23bb96604f1ffce09cc7)
Function Runtime Version: 2.0.12961.0
<snipped>
[2/20/2020 12:03:27 AM] Worker failed to function id baa45972-0e21-4a9b-a7d9-9d453269c9a8.
[2/20/2020 12:03:27 AM] Result: Failure
Exception: Worker was unable to load function letsencrypt-proxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''
    at Module.require (internal/modules/cjs/loader.js:689:11)
    at require (internal/modules/cjs/helpers.js:25:18)
    at FunctionLoader.load (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:18757:22)
    at WorkerChannel.functionLoadRequest (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16565:38)
    at ClientDuplexStream.WorkerChannel.eventStream.on (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16503:30)
    at ClientDuplexStream.emit (events.js:198:13)
    at addChunk (_stream_readable.js:287:12)
    at readableAddChunk (_stream_readable.js:268:11)
    at ClientDuplexStream.Readable.push (_stream_readable.js:223:10)
    at Object.onReceiveMessage (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:20589:19).

[2/20/2020 12:03:27 AM] Worker was unable to load function testproxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
[2/20/2020 12:03:27 AM] Worker failed to function id f1f42518-df89-4a8f-92f7-fa82a667c0ac.
[2/20/2020 12:03:27 AM] Result: Failure
Exception: Worker was unable to load function testproxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''
    at Module.require (internal/modules/cjs/loader.js:689:11)
    at require (internal/modules/cjs/helpers.js:25:18)
    at FunctionLoader.load (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:18757:22)
    at WorkerChannel.functionLoadRequest (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16565:38)
    at ClientDuplexStream.WorkerChannel.eventStream.on (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16503:30)
    at ClientDuplexStream.emit (events.js:198:13)
    at addChunk (_stream_readable.js:287:12)
    at readableAddChunk (_stream_readable.js:268:11)
    at ClientDuplexStream.Readable.push (_stream_readable.js:223:10)
    at Object.onReceiveMessage (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:20589:19).

[2/20/2020 12:03:27 AM] Worker was unable to load function filesproxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
[2/20/2020 12:03:27 AM] Worker failed to function id 1eb0444b-076b-4834-92b3-5d47b8b1f78d.
[2/20/2020 12:03:27 AM] Result: Failure
Exception: Worker was unable to load function filesproxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''
    at Module.require (internal/modules/cjs/loader.js:689:11)
    at require (internal/modules/cjs/helpers.js:25:18)
    at FunctionLoader.load (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:18757:22)
    at WorkerChannel.functionLoadRequest (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16565:38)
    at ClientDuplexStream.WorkerChannel.eventStream.on (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:16503:30)
    at ClientDuplexStream.emit (events.js:198:13)
    at addChunk (_stream_readable.js:287:12)
    at readableAddChunk (_stream_readable.js:268:11)
    at ClientDuplexStream.Readable.push (_stream_readable.js:223:10)
    at Object.onReceiveMessage (C:\myrepo\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:20589:19).
[2/20/2020 12:03:29 AM] Host lock lease acquired by instance ID '0000000000000000000000000162C11E'.
[2/20/2020 12:03:29 AM] Debugger attached.

I have also had this for the past few weeks. The proxy still seems to run, but it's unsettling to see this error every time the function starts

Azure Functions Core Tools (2.7.2184 Commit hash: 5afacc827c2848e4debc23bb96604f1ffce09cc7)
Function Runtime Version: 2.0.12961.0

Hi I'm still having the error,

Result: Failure
Exception: Worker was unable to load function missionProxy: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '''
Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''

I check the proxies' documentation and are the same.

Node Js 12.6.1

Worker was unable to load function permanentredirect: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''' [06-04-2020 02:09:29] Worker failed to function id 6c697205-462d-412f-9ee7-783089c6bc0d. [06-04-2020 02:09:29] Result: Failure Exception: Worker was unable to load function permanentredirect: 'TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''' Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received '' at Module.require (internal/modules/cjs/loader.js:661:11) at require (internal/modules/cjs/helpers.js:16:16) at FunctionLoader.load (C:\Users\Ayush\AppData\Roaming\nvm\v12.0.0\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:20061:22) at WorkerChannel.functionLoadRequest (C:\Users\Ayush\AppData\Roaming\nvm\v12.0.0\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:17821:38) at ClientDuplexStream.<anonymous> (C:\Users\Ayush\AppData\Roaming\nvm\v12.0.0\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:17738:30) at ClientDuplexStream.emit (events.js:196:13) at addChunk (_stream_readable.js:290:12) at readableAddChunk (_stream_readable.js:271:11) at ClientDuplexStream.Readable.push (_stream_readable.js:226:10) at Object.onReceiveMessage (C:\Users\Ayush\AppData\Roaming\nvm\v12.0.0\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js:21909:19).
node v 12.0
azure function core tools @ 3

Having same error, How to resolve? How to rollback to some point where it was working?

@heyAyushh I believe this error does not actually functionally break anything. If you check your proxies they should still be working even though the error displays.

hi @m-sterspace, permanentredirection works but proxy1 doesn't

{
    "proxies": {
        "proxy1": {
            "matchCondition": {
                "methods": [
                    "GET"
                ],
                "route": "/"
            },
            "backendUri": "/api/Site"
        },
        "permanentredirect": {
            "matchCondition": {
                "methods": [
                    "GET"
                ],
                "route": "/redirect"
            },
            "responseOverrides": {
                "response.statusCode": "301",
                "response.headers.Location": "/api/Site"
            }
        }
    }
}

Is this proxies.json correct?

@mhoeger Is it possible to handle these errors in the Node worker?

Taking this for next sprint

As a quick workaround, I found that editing the method throwing the exception made the alarming message go away.

The source code for the NodeJS FunctionLoader seems to be here:
https://github.com/Azure/azure-functions-nodejs-worker/blob/dev/src/FunctionLoader.ts

It's possible that testing the value of metadata.isProxy will deal with the exception.

File (on Windows)
C:\Users\[YourUserName]\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\node\worker-bundle.js

Line 20055

class FunctionLoader {
    constructor() {
        this._loadedFunctions = {};
    }
    load(functionId, metadata) {
      // Add this test
      if (metadata.isProxy) {
        console.log("FunctionLoader.load : metadata.isProxy === true : exiting early");

        return;
      }

        // Optionally - return early if scriptFilePath is empty
        // if (!scriptFilePath) {
        //   console.log("FunctionLoader.load.scriptFilePath was not supplied : exiting early");

        //   return;
        // }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

horihiro picture horihiro  路  3Comments

JasonBSteele picture JasonBSteele  路  3Comments

paulbatum picture paulbatum  路  4Comments

mathewc picture mathewc  路  3Comments

christopheranderson picture christopheranderson  路  4Comments