Next.js + D1 + SSG .. would that work?

Hi, not sure if this has been answered before .. also posting my first ever message on discord.com I am building my app with Next.js and Deploying it to Cloudflare workers. I am trying to build SSG pages using data from D1 .. will this work? When the query to get the slugs is executed, I get "Error: D1_ERROR: no such table: blog_posts: SQLITE_ERROR" when workers build is running
5 Replies
Kamil
Kamil•2mo ago
Not sure how you do it. Have you tried OpenNext adapter? It's solution to make Next.js apps running on Workers. It's backed by folks from Cloudflare and it works quite well even though it's not recommended on production yet. I suggest to try it and ask for help on their Discord server if you face any issues.
ankagar
ankagarOP•2mo ago
I am using OpenNext adapter ... what I am trying to do is generate SSG pages using 'generateStaticParams' where the params are coming from DB .. it works locally, but when running the workers build, it does not find the table from which I am getting the params
Kamil
Kamil•2mo ago
Ask on OpenNext Discord server. You won't get much help here.
ankagar
ankagarOP•2mo ago
Ok thanks for the hint 🙂 moving the discussion there
Silvan
Silvan•2mo ago
for me this sounds like you might have forgotten to run migrations on the remote server? do you see your tables in the cf dashboard?

Did you find this page helpful?