Closed msyyn closed 3 years ago
Sounds related to https://github.com/thgh/vercel-sapper/issues/54#issuecomment-741022512
I'm encountering the same issue. I did the change from #54 (comment) but the issue still persists.
Here's my server.ts
import sirv from "sirv";
import express from "express";
import compression from "compression";
import * as sapper from "@sapper/server";
const {
PORT = 3000,
NODE_ENV = "development",
} = process.env;
const dev = NODE_ENV === "development";
export default express()
.use(
compression({ threshold: 0 }),
sirv("static", { dev }),
sapper.middleware()
)
.listen(PORT);
Looks like this issue only shows up when using express
. Changing express
to polka
fixes the problem on my Vercel deployment.
Try change export default
into module.exports =
At some point the Sapper template broke the default export behaviour, but module.exports
always worked.
We can dive deeper on this if you can provide a test repo 😉
Module exports doesn't seem to help either. Experiencing the issue with this at least: https://github.com/msyyn/sapper-discord-supabase-tailwind
Okay so module.exports works.. I just had to do it like this:
const app = (module.exports = express())
and it goes through. :D
had it as module.exports = app
before
Hey, I am receiving the following error and couldn't get around what is causing it..
My deploy works just fine and finishes with no errors whatsoever, but when I load the site on Vercel it shows this in place of my site:
I tried doing what the error says; exporting it with module.exports too. My other project is using similar server file and it's working just fine?
This is my server.js: