Closed iolyd closed 8 months ago
Thanks for the report. The exact export mechanism has changed, in order to fix a bug in another context, but this should certainly still work.
I'll take a look first thing tomorrow.
I got same error
package.json
"@neondatabase/serverless": "^0.7.1",
command
esrun --tsconfig=db/tsconfig.json db/migrate.ts
tsconfig
{
"compilerOptions": {
"target": "ESNext",
"module": "esnext",
"resolveJsonModule": true,
"isolatedModules": true,
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true
}
}
I`m using @neondatabase/serverless package on Deno Deploy by npm import:
import { neon, neonConfig } from "npm:@neondatabase/serverless";
neonConfig.fetchConnectionCache = true;
const client = neon(env.DATABASE_URL);
It worked well before 0.7.1 (not sure about 0.7.0). Now I got this error while trying to deploy to Deno Deploy by using deployctl (v.1.9.1) cli utility:
error: The deployment failed: BOOT_FAILURE
Uncaught SyntaxError: The requested module './index.js' does not provide an export named 'Client'
at file:///node_modules/.deno/@neondatabase+serverless@0.7.1/node_modules/@neondatabase/serverless/index.mjs:2:3
Very sorry all, it looks like fixing #54 broke some other use cases. You should find that 0.7.2 addresses this. Please let me know (you just need to npm install @neondatabase/serverless@latest
, of course).
In this release I've given up trying to wrap the CJS code as ESM, and we now export wholly separate CJS and ESM codebases. It seems like different bundlers and platforms do different things with CJS->ESM import, and we can't rely on making everyone happy. The one caveat to this new approach is that if you use require
in some places and import
in others, you'll now get separate copies of the code that don't share any config changes you make. So don't do that.
More generally, I'm working on a test suite that includes some common deployment scenarios. Hopefully this will guard against any similar future breakages.
0.7.2 has fixed the problem on Deno Deploy. Thanks.
Confirming 0.7.2
fixes the issue on my side.
Steps to reproduce
Minor version
0.7
(tested with0.7.0
and0.7.1
) introduce breaking import error.pnpm install @neondatabase/serverless@0.6.1
pnpm up --latest
(orpnpm install @neondatabase/serverless@latest
)Expected result
Named exports should be made available like in previous version (unless this is an expected breaking change), else document new import path(s).
Actual result
Get errors unless revert to previous minor version (
0.6
)Environment
node v21.1.0
Logs, links