vercel / platforms

A full-stack Next.js app with multi-tenancy and custom domain support. Built with Next.js App Router and the Vercel Domains API.
https://app.vercel.pub
5.69k stars 756 forks source link

Edge function Error : ERR_MODULE_NOT_FOUND on an installed module #385

Open Britnell opened 9 months ago

Britnell commented 9 months ago

Hey team, I have an error I'm struggling to fix. I find similar MODULE_NOT_FOUNDS, but those seemed different.

I am using libsql/client to connect to turso db the endpoint is loading sql client :

import { createClient } from "@libsql/client/web";
export const turso = createClient({
  url: import.meta.env.TURSO_URL,
  authToken: import.meta.env.TURSO_TOKEN,
});

So it is failing to import an installed package. the build & install run fine, this works fine locally, I was using pnpm, so tried out with npm i too, but still had the same issue.

I was using bcrypt package which had problems running on edge, which i replaced with bcryptjs but libsql is a lightweight client suggested by turso, i feel like this should be able to work. Do you have any other debugging tips I can try?

Britnell commented 9 months ago

In fact i just deployed the same project to Netlify and it works fine, so this must be the astro/vercel adapter. I don't know if you have access to my vercel deploy?