neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
343 stars 13 forks source link

No such module #46

Closed jnthnclrk closed 1 year ago

jnthnclrk commented 1 year ago

Noob question…

I'm prob doing this wrong, but why won't my Cloudflare worker recognise this Neon module? I connected Neon no probs using the integration option…

import { Client } from '@neondatabase/serverless';

Screenshot 2023-08-28 at 5 31 21 PM

This import line is reference in a lot of CF worker Neon docs: https://developers.cloudflare.com/workers/databases/native-integrations/neon/

TimoWilhelm commented 1 year ago

You'll probably need to bundle your worker code before depoying it to Cloudflare. Are you using Wrangler to deploy your worker?

jnthnclrk commented 1 year ago

Right, so you can't just key import statements into the CF UI?

TimoWilhelm commented 1 year ago

Probably not. It would not resolve dependencies from NPM. I'd reccomend following the Getting Started Guide on developing with the wrangler CLI.

jawj commented 1 year ago

Thanks @TimoWilhelm. Indeed — to import npm packages, you need to be bundling your functions with wrangler.