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

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}"
    }
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 27 (3 by maintainers)

Most upvoted comments

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.

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] Exception: 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] Stack: TypeError [ERR_INVALID_ARG_VALUE]: The argument ‘id’ must be a non-empty string. Received ‘’ [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

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;
        // }

@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.

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

Same problem, came out of nowhere Also using Node image

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