Closed wojtekmaj closed 3 months ago
Hi @wojtekmaj can you share your version of core tools and the "@azure/functions" npm package? If you have sample repro code, that would also be very helpful
@ejizba @azure/functions was at 3.5.1 in the project I could reproduce that in. I don't think that's relevant though. I can now see that what was thrown from my function was not Error
, but ZodError
from zod
schema validation library. I believe ensureErrorType
helper does not account for this. When "pure" Error
is thrown the issue cannot be reproduced.
Okay I think I understand what's happening here. The ZodError type apparently makes the "message" property read-only and doesn't let us change the message. We'll look into this. If you need a workaround in the meantime, you could probably catch the error yourself and either log it or convert it to a more normal error type that we can handle
I have just merged two PRs that should resolve this issue: https://github.com/Azure/azure-functions-nodejs-worker/pull/732 and https://github.com/Azure/azure-functions-nodejs-library/pull/220.
When these changes are deployed, I will close out this issue.
@castrodd Is the fix available on Azure yet? We are experiencing a similar problem and I'm not able to find any information on the currently deployed function-host versions.
@sladkoff It actually just started rolling out and should finish in the next couple weeks. At least for Node.js, you could check our github releases here. Of course, commenting on a specific issue is also probably one of the best ways to get this info 🙂 Btw, if you're on Windows consumption and want to test it out today, I believe the East Asia and West Central US regions already have the fix.
We're seeing a TypeError in this updated code that causes an unhandled promise rejection. Details in the PR: https://github.com/Azure/azure-functions-nodejs-worker/pull/732#discussion_r1604141371.
This PR should have fixed this issue: https://github.com/Azure/azure-functions-nodejs-worker/pull/750
Facing the exact same thing, which took me quite some time to figure out what actually was wrong.
We´re using zod
to parse/validate configuration, which sometimes happens in global context.
Azure Functions Core Tools Core Tools Version: 4.0.5907 Commit hash: N/A +807e89766a92b14fd07b9f0bc2bea1d8777ab209 (64-bit) Function Runtime Version: 4.834.3.22875
@azure/functions: 3.5.1
Is there any ETA, when this gets shipped? Currently working around by wrapping the causing logic in a try/catch and throwing a new Error
(combined with a console.error
, as the logic currently is out of a context
).
I have prepared a simple repro here:
https://github.com/earloc/repros-azure-functions-nodejs-library
When attempting to run a function, which crashed on startup (for an unrelated reason), I got the following error:
instead of the actual error message that got thrown by my function.
worker-bundle.js:2:33509
corresponds to this line:so there's something wrong with the way errors are handled.