better-auth-kit
better-auth-kit copied to clipboard
App Invite crashing Vercel/Vite deployment
This is a critical bug that is preventing me from using the app-invite plugin in a real SvelteKit (Vite) app. I have a monorepo that deploys to Vercel and adding app-invite crashes the deployments.
When using app invite as stated from the docs, here is the Vercel log
file:///var/task/apps/platform/.svelte-kit/output/server/chunks/auth.js:9
import { appInvite } from "@better-auth-kit/app-invite";
^^^^^^^^^
SyntaxError: Named export 'appInvite' not found. The requested module '@better-auth-kit/app-invite' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@better-auth-kit/app-invite';
const { appInvite } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:182:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:266:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async get_hooks (file:///var/task/apps/platform/.svelte-kit/output/server/chunks/internal.js:511:49)
at async file:///var/task/apps/platform/.svelte-kit/output/server/index.js:3603:24
at async Server.init (file:///var/task/apps/platform/.svelte-kit/output/server/index.js:3601:5)
at async file:///var/task/apps/platform/.svelte-kit/vercel-tmp/index.js:11:1
Node.js process exited with exit status: 1. The logs above can help with debugging the issue.
Locally and on Vercel I have tried a potential fix but it didn't work either:
Error when evaluating SSR module /src/routes/(auth)/login/+page.server.ts: [vite] Named export 'default' not found. The requested module '@better-auth-kit/app-invite' is a CommonJS module, which may not
support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@better-auth-kit/app-invite';
const {default} = pkg;
I am not sure how to fix this and would like your insight on the cause and potential fix. I appreciate your great work!
Let me know if you need additional information!
@ping-maxwell