-
Notifications
You must be signed in to change notification settings - Fork 97
fix: check type before using string-only method #2393
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
Conversation
✅ Deploy Preview for deft-cannoli-70cc77 canceled.
|
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for amazing-dieffenbachia-02ea4a ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-nextjs-demo-all-flags ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
MarcL
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I assume we're ok to bump the demos to Node 20.
Description
Our override of
fs/promises->readFileassumes that first argument is astring.readFiledoes accept multiple types - includingURLthat is used by Node.js itself (https://github.com/nodejs/node/blob/8cdb7cae98468efee222727ad9a4096e415f3ef6/lib/internal/modules/esm/load.js#L44-L46) when loading ESM module.This adds typeguard to prevent trying to use
.startsWithif argument is not a string. As we only care here about specific context ofreadFileusage - this continues to use a string, so we don't have to try to handle all the possible types thatreadFileaccept and only need to handle actual types used in that context. If type is not string, we will do passthrough to originalfs/promises.readFilefunctionDocumentation
Tests
You can test this change yourself like so:
Relevant links (GitHub issues, etc.) or a picture of cute animal
https://answers.netlify.com/t/all-nextjs-builds-returning-500-error-with-typeerror-file-startswith-is-not-a-function/107758/10