-
Notifications
You must be signed in to change notification settings - Fork 549
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
performance.markResourceTiming is not a function
in Node 18.x on AWS Lambda
#2110
Comments
this seems like an issue with AWS? I'd like to know why it's happening before patching it though. |
The linked URL is asking me for a Gitlab username/password, is it private? |
Woops sorry, just made that public now |
The link you pointed us to is from Node.js core. If that's the problem you are dealing with, there is way we can fix it as we have absolutely no control on what AWS Lambda ships. Ultimately, updating Node.js would fix this problem, but it's not our responsibility. What we can do is fixing undici so it runs correctly on Node v18.5.0 (and add it to CI), but the bundled version on Node.js core would stay buggy. |
Thanks Matteo, I appreciate that. Unfortunately from the stack trace I've seen it's unclear as to what triggers this code path, do you know if |
It is expected, but it was added in node v18.2.0 so I'm not sure why it wouldn't work. |
Interestingly, using the proprietary code, I get the same error when using a Docker image that is following aws/aws-lambda-nodejs-runtime-interface-client#53 for an official NodeJS Docker image, not just Amazon's version The only other similar case I could find while searching around is golang/go#57516 It may be that Amazon's https://www.npmjs.com/package/aws-lambda-ric - which hasn't been updated since Node 16 - just may not work with the new performance code brought in as part of Node 18, and as this is a bit of a workaround, not a general usecase, it may explain why it's not been seen anywhere else. |
I appear to have gotten around the issue by setting
It's unclear as to whether this is introduced through the polyfills, for instance if the libraries I'm using can't use the polyfills, or if there's something else at play. I'll keep this thread updated to see if this issue continues, and try and get a minimal reproduction. |
i have the same issue :) using |
There is literally nothing that can be done, as we do not control what version of Node.js AWS ships with Lambda. |
Bug Description
When running the below linked code, the Node process crashes with an undici-related issue due to the
markResourceTiming
function being undefined, when it does appear to exist.Reproducible By
I've started a reproduction case for https://gitlab.com/jamietanna/bug-nodejs18-undici-renovate but unfortunately it doesn't seem to be working (as I'm trying to reproduce from some proprietary code) but will work to get it updated.
Expected Behavior
No error.
Logs & Screenshots
Environment
AWS Lambda,
node18.x
runtime with NodeJS version v18.5.0Additional context
My debugging so far, via the README of the reproduction repo:
Prerequisites to reproduce
Due to a requirement (from the original case that this issue appeared in) to use the system-installed version of Git, we need to use a container image.
RENOVATE_TOKEN
set to apublic_repo
classic GitHub Personal Access TokenA pre-built image can be found at:
And can be re-published to a private ECR for use with the container image function.
Error
The error we see, when the Lambda is triggered, is:
We can see that this corresponds to this function:
Where
performance
is imported fromperf_hooks
:Is it set?
Writing the following pure JavaScript to debug:
We can see the following output:
So it's unclear as to why we're seeing it not set.
When we're using TypeScript:
Trying to build this, we see a compilation error:
But we can get around it with:
The text was updated successfully, but these errors were encountered: