fix(explicabl): drop undeclared node-fetch import; use global fetch#37
Open
davidcrowe wants to merge 1 commit into
Open
fix(explicabl): drop undeclared node-fetch import; use global fetch#37davidcrowe wants to merge 1 commit into
davidcrowe wants to merge 1 commit into
Conversation
…l fetch health.ts imported `node-fetch` but the package declared only express and express-rate-limit. Because dist/index.js re-exports health.js, the published @gatewaystack/[email protected] threw ERR_MODULE_NOT_FOUND on ANY import from a fresh install — including createConsoleLogger, which has nothing to do with the health route. Same defect class as the proxyabl-core/jose break (PR #35). The two call sites use only standard WHATWG fetch semantics (.ok/.status, {method,headers,body}), so Node 18+'s global fetch is a drop-in. Removing the import also makes the README's 'zero dependencies beyond Express' claim true. Add engines.node >=18 to make the global-fetch requirement explicit; bump to 0.0.9. Verified: packed tarball installs into an empty project and imports with all 5 exports; full suite (159 tests) green.
Collaborator
Author
|
Reviewed + confirmed green (build + test SUCCESS, MERGEABLE/CLEAN). Drops the undeclared @davidcrowe — needs your merge + republish (OTP): |
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.
Problem
@gatewaystack/[email protected]is broken on fresh install — the same defect class as the proxyabl-core/jose break in #35.src/health.ts:2doesimport fetch from "node-fetch", but the package declares onlyexpressandexpress-rate-limit. Sincedist/index.jsre-exportshealth.js, every import of the package fails:This hits users who only want
createConsoleLoggerorexplicablLoggingMiddlewareand never touch the health route. It also contradicts the README's "Zero dependencies beyond Express" (line 20).Fix
The two call sites (
health.ts:73,:86) use only standard WHATWG fetch (.ok,.status,{method, headers, body}) — a drop-in for Node 18+'s globalfetch. So: delete the import, addengines.node >=18to make the requirement explicit, bump to 0.0.9. Declaringnode-fetchwould also fix the crash, but it's dead weight on modern Node and would keep the README claim false.Verification
auth0LogsWebhook,createConsoleLogger,explicablLoggingMiddleware,explicablRouter,healthRoutes)Needs a republish after merge (0.0.9).