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

be defensive in reading/parsing Azure Function "function.json" and "host.json" #3185

Open
trentm opened this issue Mar 2, 2023 · 3 comments · May be fixed by #4178
Open

be defensive in reading/parsing Azure Function "function.json" and "host.json" #3185

trentm opened this issue Mar 2, 2023 · 3 comments · May be fixed by #4178
Assignees
Labels
agent-nodejs Make available for APM Agents project planning. impact:high Short-term priority; add to current release, or definitely next.

Comments

@trentm
Copy link
Member

trentm commented Mar 2, 2023

The Azure Functions instrumentation assumes that "function.json" and "../host.json" exist and are valid JSON in an Azure Function. If that isn't the case, then the APM agent (and the Azure Function worker process) could crash.

Those files are specified here:

My understanding is that a Node.js Azure Function is invalid and non-functional without those files, but I haven't tried hard to break it.

The APM agent should fallback to just not instrumenting the Azure Function (or limited instrumentation) if there is a problem reading those files.

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Mar 2, 2023
@Grant-Visser
Copy link

Grant-Visser commented Dec 4, 2023

function.json file has been removed in the new Azure functions 4 implementation for javascript functions, meaning this is now an incompatibility as far as I can see. Here's a stacktrace:

Message processing error (Action=ProcessMessageCallback, EntityPath=webhook-update, Endpoint=No)
System.Private.CoreLib: Exception while executing function: Functions.serviceBusQueueTrigger1. System.Private.CoreLib: Result: Failure
Exception: bindingDefinitions is not iterable
Stack: TypeError: bindingDefinitions is not iterable
    at new FunctionInfo (/project/node_modules/elastic-apm-node/lib/instrumentation/azure-functions.js:74:22)

Trying to find a way around this now.

@trentm trentm added the impact:high Short-term priority; add to current release, or definitely next. label Dec 4, 2023
@trentm trentm self-assigned this Jan 4, 2024
@suhaschintala12
Copy link

suhaschintala12 commented Mar 18, 2024

@Grant-Visser

Trying to find a way around this now.

Any update on this issue? I am facing the same issue. I am using apm agent nodejs 4.5.0 and azure functions 4.1 and simple azure function setup fails with the bindingDefinitions error

@mito4ek
Copy link

mito4ek commented Jun 25, 2024

Same issue for me :(

"elastic-apm-node": "4.7.0"
"@azure/functions": "4.5.0"

qzxclkj added a commit to qzxclkj/apm-agent-nodejs that referenced this issue Aug 2, 2024
Since Azure Function v4, the invocaation context structure has changed.

Closes: elastic#3185
qzxclkj added a commit to qzxclkj/apm-agent-nodejs that referenced this issue Aug 2, 2024
Since Azure Function v4, the invocation context structure has changed.

Closes: elastic#3185
@qzxclkj qzxclkj linked a pull request Aug 3, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning. impact:high Short-term priority; add to current release, or definitely next.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants