fix: declare @nrfcloud/validate-with-typebox as a runtime dependency - #73
Merged
Merged
Conversation
`problemResponse.ts`, `validateInput.ts` and `validateResponse.ts` import `@nrfcloud/validate-with-typebox`, but it was declared as a devDependency, so it is missing from the published package's dependency tree. This did not surface while the package was published to JSR: JSR's NPM compatibility build derives the dependency list from the actual imports, so it published `@jsr/nrfcloud__validate-with-typebox` as a runtime dependency regardless of how it was declared here. The NPM build publishes the declared dependencies verbatim, so the mis-declaration became a real defect. Consumers that do not happen to have `@nrfcloud/validate-with-typebox` in their own dependency tree fail at import time with ERR_MODULE_NOT_FOUND.
Member
Author
|
Non-significant change, no PR review required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves
@nrfcloud/validate-with-typeboxfromdevDependenciestodependencies.The bug
problemResponse.ts,validateInput.tsandvalidateResponse.tsall import@nrfcloud/validate-with-typebox, but it is declared as a devDependency, sothe published package does not pull it in. Consumers that do not independently
have it in their tree fail at import time.
Reproduced against the currently published
@nrfcloud/lambda-helpers@1.0.30,installing it the way a Lambda layer does — only the listed dependencies, no dev
dependencies:
With this change the same install pulls in
problem-detailandvalidate-with-typebox, and the import succeeds.Why it only appeared now
While this package was published to JSR, JSR's NPM compatibility build derived
the dependency list from the actual imports, so it shipped
@jsr/nrfcloud__validate-with-typeboxas a runtime dependency no matter how itwas declared here — it is still visible in the published
@jsr/nrfcloud__lambda-helpers@1.0.28metadata. Publishing to NPM uses the declared dependencies verbatim, which
exposed the long-standing mis-declaration.
How it was found
account-service-nextbuilds its Lambda layers from an explicit subset ofdependencies. Its
cognitoAuthLayerlists@nrfcloud/lambda-helpersbut not@nrfcloud/validate-with-typebox, so the authorizer Lambdas could not resolveit, failed to initialise, and API Gateway answered every authorized request with
AuthorizerConfigurationException.All six of the migrated libraries were audited for the same class of problem;
this is the only one affected.
Verified locally
The type check, tests and build pass, and
npm cireinstalls from theregenerated lock file.