You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have semantic-release configured to a custom registry and the get-last-release plugin tries to get the last version published in order to know what the next version should be; however, this registry returns different body than the official npm registry (text rather than empty json) causing semantic-release to fail at parsing the body.
Example:
Custom registry returns 404 with text/html
Request: GET http://bbnpm.azurewebsites.net/non-existent-package
Response: 404 The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.`
Official registry returns 404 with application/json
Request: GET https://registry.npmjs.org/non-existent-package
Response: {}
This could be blamed on the custom registry that they don't return same response as official thus breaking API; however, neither of them respect the Accept header so it's probably not spec'd.
Either way, semantic release should have enough information to determine there is no last version because of the return code 404. It also could look at the Content-Type header to know how/when to parse the body.
Yes this is one of the numerous problems we had trying to integrate with various npm registries. As there is no specifications, all "npm compatible" registries have different behavior.
For this reason and others we don't use the npm registry anymore to retrieve the last release. We now rely on Git tags. See #613.
This PR has been released in the @next dist-tag. You can use it with semantic-release 13.0.0.
I'm going to go ahead and close this issue as the getLastRelease plugin doesn't exist anymore in [email protected] so the problematic code is not there anymore.
I recommend to upgrade to [email protected] which available on the @next dist-tag.
Current behavior
I have semantic-release configured to a custom registry and the
get-last-release
plugin tries to get the last version published in order to know what the next version should be; however, this registry returns different body than the official npm registry (text rather than empty json) causing semantic-release to fail at parsing the body.Example:
Custom registry returns 404 with text/html
Request:
GET http://bbnpm.azurewebsites.net/non-existent-package
Response: 404 The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.`
Official registry returns 404 with application/json
Request:
GET https://registry.npmjs.org/non-existent-package
Response:
{}
This could be blamed on the custom registry that they don't return same response as official thus breaking API; however, neither of them respect the
Accept
header so it's probably not spec'd.Either way, semantic release should have enough information to determine there is no last version because of the return code 404. It also could look at the
Content-Type
header to know how/when to parse the body.The custom registry looks like: http://www.verdaccio.org/ but I'm not very familiar with that.
Expected behavior
If the return code is 404 it should assume the package doesn't exist and no try to parse the body.
Environment
The text was updated successfully, but these errors were encountered: