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

Publish failure message is masked by TypeError: _b.toUpperCase is not a function #119

Closed
andybalaam opened this issue Jul 11, 2023 · 6 comments · Fixed by #120
Closed

Publish failure message is masked by TypeError: _b.toUpperCase is not a function #119

andybalaam opened this issue Jul 11, 2023 · 6 comments · Fixed by #120
Labels
bug Something isn't working

Comments

@andybalaam
Copy link

Hi, our NPM publish failed after your (much-appreciated) change to upgrade us to npm-publish@v2:

https://github.com/matrix-org/matrix-react-sdk/actions/runs/5520127165/jobs/10066320474

but the error message is masked by this error:

Run JS-DevTools/npm-publish@a25b4180b728b0279fca97d4e5bccf391685aead
Error: TypeError: _b.toUpperCase is not a function

This seems to be caused by this line:

errorCode = errorPayload?.error?.code?.toUpperCase();

from https://github.com/JS-DevTools/npm-publish/blob/main/src/npm/call-npm-cli.ts#L79

It looks like the code is not a string?

@mcous
Copy link
Member

mcous commented Jul 11, 2023

How embarrassing! Thanks for the report and the helpful lesson in making assumptions when consuming JSON from third parties.

I've just released 2.2.1 which will resolve the TypeError and let us see what's actually going on. I also added some extra debug logging around the call to the npm CLI which could help in the future.

I'll keep an eye out in case whatever issue this was hiding is also related to a bug here

- uses: JS-DevTools/npm-publish@5a85faf05d2ade2d5b6682bfe5359915d5159c6c # v2.2.1
@andybalaam
Copy link
Author

Don't be embarrassed :-) We've upgraded to 2.2.1 and we'll find out on Tuesday whether it improves matters.

Thanks for the fix!

@andybalaam
Copy link
Author

Hi, we still got a failure (for still-mysterious reasons, since it works for me on my dev machine...) and the error, while different, is no more enlightening:

https://github.com/matrix-org/matrix-react-sdk/actions/runs/5555607767/jobs/10146998436

Error: NpmCallError: Call to "npm publish" exited with non-zero exit code 1
error Command failed with exit code 1.
error Command failed with exit code 1.

Do you have any ideas how we can find out what is going on?

Thanks for your help!

@mcous
Copy link
Member

mcous commented Jul 18, 2023

Hi @andybalaam, if you haven't already, you could try re-running the job with debug enabled from the GitHub UI. This will print the exact npm call used and any stdout or stderr from the CLI, which could give us more insight.

I'm on vacation with my family until Friday, but I can take a closer look on Saturday!

@mcous
Copy link
Member

mcous commented Jul 18, 2023

A random thought: I know y'all run a pre-publish script which runs a build step. Perhaps it is that build script that is failing? Might explain the lack of info from npm, because expected stuff like auth failures have well defined codes that you would be seeing if that was the cause

@andybalaam
Copy link
Author

Hi @andybalaam, if you haven't already, you could try re-running the job with debug enabled from the GitHub UI. This will print the exact npm call used and any stdout or stderr from the CLI, which could give us more insight.

Thank you for the tip - I have done that here: https://github.com/matrix-org/matrix-react-sdk/actions/runs/5587454119/jobs/10212963945 and I can see there are errors from our TypeScript process.

I'm on vacation with my family until Friday, but I can take a closer look on Saturday!

Enjoy your holiday and don't give this another thought! You have already helped a bunch.

A random thought: I know y'all run a pre-publish script which runs a build step. Perhaps it is that build script that is failing? Might explain the lack of info from npm, because expected stuff like auth failures have well defined codes that you would be seeing if that was the cause

Yes, you were right. Now I will attempt to figure out why ... :-)

@mcous mcous added the bug Something isn't working label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants