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

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

Closed
iyerusad opened this issue Jun 22, 2019 · 27 comments · Fixed by Azure/azure-functions-nodejs-worker#299
Assignees

Comments

@iyerusad
Copy link

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: cd9bfca)
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}"
    }
  }
}
@ahmedelnably
Copy link

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

@iyerusad
Copy link
Author

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

@MECLab-Keags
Copy link

Having the same issue here with javascript function on Node.

@ahmedelnably
Copy link

@pragnagopa is this a known issue?

@pragnagopa
Copy link
Member

@mhoeger - Can you please take a look?

@harshitsanghvi
Copy link

Having the same issue, using Node.

@iyerusad
Copy link
Author

iyerusad commented Aug 1, 2019

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.

@david0178418
Copy link

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

@ahmelsayed ahmelsayed transferred this issue from Azure/azure-functions-core-tools Aug 16, 2019
@benc-uk
Copy link

benc-uk commented Aug 17, 2019

Same problem, came out of nowhere
Also using Node
image

@billbliss
Copy link

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

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

Is there a workaround anyone knows about?

@billbliss
Copy link

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.

@fabiocav fabiocav added this to the Triaged milestone Oct 10, 2019
@sadranyi2u
Copy link

this is still happening as of today Nov 8, 2019

@stefannilsson
Copy link

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

@abiabsurd
Copy link

this is still happening as of today Nov 8, 2019

Likewise for me.

@mpho-mbonani
Copy link

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

@iyerusad
Copy link
Author

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

@jeffhollan
Copy link

jeffhollan commented Dec 11, 2019

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

@m-sterspace
Copy link

m-sterspace commented Feb 14, 2020

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

@iyerusad
Copy link
Author

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.

@nickplennox
Copy link

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

@mangel0111
Copy link

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

@heyAyushh
Copy link

heyAyushh commented Apr 6, 2020

[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?

@m-sterspace
Copy link

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

@heyAyushh
Copy link

heyAyushh commented Apr 6, 2020

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?

@anthonychu
Copy link
Member

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

@mhoeger mhoeger modified the milestones: Triaged, Functions Sprint 76 May 7, 2020
@mhoeger
Copy link
Contributor

mhoeger commented May 7, 2020

Taking this for next sprint

@snerks
Copy link

snerks commented May 12, 2020

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

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

Successfully merging a pull request may close this issue.