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

Error when using @azure/ms-rest-nodeauth #820

Open
martin-fuhrer opened this issue Nov 26, 2021 · 5 comments
Open

Error when using @azure/ms-rest-nodeauth #820

martin-fuhrer opened this issue Nov 26, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@martin-fuhrer
Copy link

We updated one of our projects from @zeit/ncc to @vercel/ncc and get a runtime error "TypeError: Cannot read property 'split' of undefined" since then. I could nail it down to a function import from @azure/ms-rest-nodeauth.

The attached file contains a minimal project demonstrating the error. To reproduce it, please execute these commands:

tar xvzf ncc-test.tar.gz
cd ncc-test
npm i
npm run build
node dist/index.js
--> the error message is displayed

When going back to @zeit/ncc, the error doesn't occur anymore:

npm uninstall @vercel/ncc
npm i @zeit/ncc
npm run build
node dist/index.js
--> the expected output "function" is displayed

ncc-test.tar.gz

@styfle
Copy link
Member

styfle commented Dec 6, 2021

That is strange. When you remove the minify command, you can see the error is coming from axios trying to split a package.json without a version prop https://github.com/axios/axios/blob/5112ba3ee1cdd287638f4cc81d7dd0edaf67ca15/lib/helpers/validator.js#L15

The workaround is adding a version property to your package.json

@alaingiller
Copy link

It is interesting, but how it can works with @zeit/ncc then ? The dependencies are the same and the package.json too.

@styfle
Copy link
Member

styfle commented Dec 11, 2021

It seems like its resolving the wrong package.json here

https://github.com/axios/axios/blob/5112ba3ee1cdd287638f4cc81d7dd0edaf67ca15/lib/helpers/validator.js#L3

It doesn't fail when using JS source, only TS source so that makes me think the baseUrl in tsconfig.json is causing the issue.

cc @guybedford

@styfle styfle added the bug Something isn't working label Dec 11, 2021
@guybedford
Copy link
Contributor

If it's just the _resolved, _integrity and _from fields that are different, those are metadata markers added by npm, so it could be a metadata difference. Or are there other fields diffing apart from those?

@styfle
Copy link
Member

styfle commented Dec 17, 2021

@guybedford In this case, its not just the private fields, its actually the wrong package.json (it uses the root package.json from the cwd instead of node_modules/axios/package.json)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants