How to deploy next app using cloudflare workers?
I know that cloudflare offers pages for easy deployment of next. I cannot use pages because my repo is not hosted on github/gitlab.
I looked at next-on-pages project and I am building my project using
next-on-pages
as the build command in my script which creates a .vercel
directory and I have setup the main file of the worker correctly as well. This is my wrangler.toml
file:
where cfbuild
is my custom script.
I deploy this project to workers using wrangler deploy
and the deployment happens correctly but when I visit the worker link, I am getting Internal Server Error
.
How do i fix it?6 Replies
You can use Pages via
wrangler pages deploy
, even if you don't use GitHub/Lab
I don't think we support Workers deploys for next-on-pages
If i do
wrangler pages deploy
, the build is going to be created locally first right?Doing
wrangler pages deploy
doesn't build anything. You still need to build with next-on-pages
firstYes, that's exactly what I was asking. Also, is there a need to have wrangler toml as well or i need to configure it by going to the cf dashboard?
You can configure bindings etc via the dashboard if you want
I did
wrangler pages deploy
and the deployment has been created and I can see it in the cf dashboard as well but when I am visiting the link now, it is showing This site can’t be reached
chrome page. This is my wrangler toml file for pages:
What am i doing wrong?
Ah, it worked.
I thought the DNS changes are instant, it took a while but I can see it now.
Thanks for the help