Solid-start-vercel rollup error

Hey, I am trying to build my solidstart app with solid-start-vercel package included (it works just fine without it) and I am getting this error
base = Object.assign(new Error(base.message), base);23:18:46 ^23:18:4623:18:46Error [RollupError]: Module format "cjs" does not support top-level await. Use the "es" or "system" output formats rather.23:18:46 at error (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)23:18:46 at Module.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:13883:20)23:18:46 at Chunk.renderModules (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:16335:41)23:18:46 at Chunk.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:15843:111)23:18:46 at file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:7223:18:46 at Array.map (<anonymous>)23:18:46 at renderChunks (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:53)23:18:46 at Bundle.generate (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17702:19)23:18:46 at async file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:26543:2723:18:46 at async catchUnfinishedHookActions (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:25676:16)23:18:46 at async Object.build (file:///vercel/path0/node_modules/solid-start-vercel/index.js:183:7) {23:18:46 code: 'INVALID_TLA_FORMAT',23:18:46 id: '/vercel/path0/.solid/server/entry-server.js'23:18:46}23:18:4623:18:46Node.js v18.15.023:18:46Error: Command "npm run build" exited with 123:18:46BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1
base = Object.assign(new Error(base.message), base);23:18:46 ^23:18:4623:18:46Error [RollupError]: Module format "cjs" does not support top-level await. Use the "es" or "system" output formats rather.23:18:46 at error (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)23:18:46 at Module.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:13883:20)23:18:46 at Chunk.renderModules (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:16335:41)23:18:46 at Chunk.render (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:15843:111)23:18:46 at file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:7223:18:46 at Array.map (<anonymous>)23:18:46 at renderChunks (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17480:53)23:18:46 at Bundle.generate (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:17702:19)23:18:46 at async file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:26543:2723:18:46 at async catchUnfinishedHookActions (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:25676:16)23:18:46 at async Object.build (file:///vercel/path0/node_modules/solid-start-vercel/index.js:183:7) {23:18:46 code: 'INVALID_TLA_FORMAT',23:18:46 id: '/vercel/path0/.solid/server/entry-server.js'23:18:46}23:18:4623:18:46Node.js v18.15.023:18:46Error: Command "npm run build" exited with 123:18:46BUILD_UTILS_SPAWN_1: Command "npm run build" exited with 1
I tried to search online and also in this DC server but haven't found anything quite like it. I know solid-start-vercel is experimental, I just couldn't manage to make my app work on vercel without it. Thanks for help in advance.
19 Replies
Tommypop
Tommypop2y ago
Hi, are you able to show your vite config?
Rytkef
RytkefOP2y ago
import solid from "solid-start/vite";
import vercel from "solid-start-vercel"
import suidPlugin from "@suid/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig(() => { return {
plugins: [
solid({ssr:false, adapter: vercel() }),
suidPlugin()],
}})
import solid from "solid-start/vite";
import vercel from "solid-start-vercel"
import suidPlugin from "@suid/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig(() => { return {
plugins: [
solid({ssr:false, adapter: vercel() }),
suidPlugin()],
}})
I could also share package.json or tsconfig if it were to help
Tommypop
Tommypop2y ago
Awesome, thanks
Rytkef
RytkefOP2y ago
package.json
{
"name": "testproj",
"scripts": {
"dev": "solid-start dev",
"build": "solid-start build",
"start": "solid-start start"
},
"type": "module",
"devDependencies": {
"@types/node": "^18.11.18",
"esbuild": "^0.14.54",
"postcss": "^8.4.21",
"solid-start-node": "^0.2.26",
"solid-start-vercel": "^0.2.26",
"typescript": "^4.9.4",
"vite": "^4.3.9",
"zod": "^3.21.4"
},
"dependencies": {
"@solidjs/meta": "^0.28.2",
"@solidjs/router": "^0.8.2",
"@suid/icons-material": "^0.6.1",
"@suid/material": "^0.12.1",
"@suid/vite-plugin": "^0.1.3",
"@trpc/client": "^10.18.0",
"@trpc/server": "^10.18.0",
"googleapis": "^118.0.0",
"solid-icons": "^1.0.4",
"solid-js": "^1.6.11",
"solid-masonry": "^0.1.6",
"solid-start": "^0.2.26",
"solid-start-trpc": "^0.0.16",
"undici": "^5.15.1"
},
"engines": {
"node": ">=18.16.1"
}
}
{
"name": "testproj",
"scripts": {
"dev": "solid-start dev",
"build": "solid-start build",
"start": "solid-start start"
},
"type": "module",
"devDependencies": {
"@types/node": "^18.11.18",
"esbuild": "^0.14.54",
"postcss": "^8.4.21",
"solid-start-node": "^0.2.26",
"solid-start-vercel": "^0.2.26",
"typescript": "^4.9.4",
"vite": "^4.3.9",
"zod": "^3.21.4"
},
"dependencies": {
"@solidjs/meta": "^0.28.2",
"@solidjs/router": "^0.8.2",
"@suid/icons-material": "^0.6.1",
"@suid/material": "^0.12.1",
"@suid/vite-plugin": "^0.1.3",
"@trpc/client": "^10.18.0",
"@trpc/server": "^10.18.0",
"googleapis": "^118.0.0",
"solid-icons": "^1.0.4",
"solid-js": "^1.6.11",
"solid-masonry": "^0.1.6",
"solid-start": "^0.2.26",
"solid-start-trpc": "^0.0.16",
"undici": "^5.15.1"
},
"engines": {
"node": ">=18.16.1"
}
}
tsconfig
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"jsxImportSource": "solid-js",
"jsx": "preserve",
"strict": true,
"types": ["solid-start/env"],
"baseUrl": "./",
"paths": {
"~/*": ["./src/*"]
}
}
}
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"jsxImportSource": "solid-js",
"jsx": "preserve",
"strict": true,
"types": ["solid-start/env"],
"baseUrl": "./",
"paths": {
"~/*": ["./src/*"]
}
}
}
Tommypop
Tommypop2y ago
Does dev mode work?
Rytkef
RytkefOP2y ago
Yeah, but I forgot I have edited vite config since I tried it in dev mode I just updated it, one change, ssr set to false
Tommypop
Tommypop2y ago
Where are you using your googleapis dependency? Since it's nodejs only
Rytkef
RytkefOP2y ago
On the server side, I am using it for authorization
Tommypop
Tommypop2y ago
awesome You may be able to add this build: { target: "esnext" } to your config Or rollupOptions: { output: { format: "es" } } It looks like one of your deps is cjs, but I've checked all of them on npm and they all seem to be es compatible
Rytkef
RytkefOP2y ago
Yeah, I have already tried both of these
Tommypop
Tommypop2y ago
Huh I can't reproduce a build issue with your exact package.json, tsconfig, and vite config
Rytkef
RytkefOP2y ago
I had the same thought, tried to make rollup produce "es" instead of "csj" output, but none of these made any change
Tommypop
Tommypop2y ago
That's really weird Maybe try removing dependencies one by one, and you might eventually find what dep causes it
Rytkef
RytkefOP2y ago
Maybe I'll try clearing node modules and package lock
Tommypop
Tommypop2y ago
That's probably a good thing to try first
Rytkef
RytkefOP2y ago
So clearing didn't help, I went one by one As I mention in original post, not using vercel as adapter makes it work And when using vercel as adapter removing googlapis makes it work I guess problem is somewhere between them, I'll try to find out, but at least I have some direction Thank you for your help
Tommypop
Tommypop2y ago
Do vercel envs have access to node APIs? As google APIs fairly extensively uses node APIs I think. Maybe that's where the CJS problem lies? You're welcome, I haven't really done much lol
Rytkef
RytkefOP2y ago
I don't know, I'll look into it some more in the evening it could be the culprit If it is the case I might simply stop using the googlapis package, I can probably write the auth routine without it Solved the issue - it was indeed the googlapis, not the package itself, but the way I used it, one async call was outside of class and got to the top level during rollup processing. Thanks, you helped me a lot
Tommypop
Tommypop2y ago
Awesome
Want results from more Discord servers?
Add your server