Crash when deploying SvelteKit + Lucia...works on localhost

Of COURSE it works on localhost; doesn't it always πŸ˜‰ I'm getting the following logs after attempting to deploy to Railway. This is my first post here, so I'm not sure which project id you need. https://railway.app/project/b855592c-9156-4020-9543-d41a4e939fde -- it's called "troubled-finger" on my dashboard I built a SvelteKit + MySQL + Lucia (a new authentication library for SvelteKit, based on Prisma). I did not use the Railway Prisma template, I just used a regular NodeJS to start. Everything was deploying fine up until I added this new Prisma-based Lucia library. Runs great on localhost, but crashes on deploy. node build/index.js file:///app/build/server/chunks/lucia-06ea1b47.js:24534 import_path.default.join(dirname, "../query-engine-darwin"); ^ ReferenceError: dirname is not defined in ES module scope This file is being treated as an ES module because it has a '.js' file extension and '/app/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension. at file:///app/build/server/chunks/lucia-06ea1b47.js:24534:27 at file:///app/build/server/chunks/lucia-06ea1b47.js:36565:3 at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:533:24) at async Server.init (file:///app/build/server/index.js:2926:22) at async file:///app/build/handler.js:16001:1
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
1 Reply
VoiceOfSoftware
VoiceOfSoftwareOPβ€’3y ago
Found it! I grabbed some package.json magic from Railway Prisma template: Inside of the "scripts" section: "migrate:dev": "prisma migrate dev", "migrate:deploy": "prisma migrate deploy", "migrate:status": "prisma migrate status", "generate": "prisma generate" Inside "dependencies": "@prisma/client": "4.5.0", Inside devDependencies: "prisma": "4.5.0",
Want results from more Discord servers?
Add your server