Suddenly can’t open my website
I have a nextjs website hosted in pages. Suddenly the dynamic route can’t open on my website.
For example:
- https://example.com (work)
- https://example.com/[id] (not work, internal server error)
I tried to open the dynamic url on my local and everything was fine.
After doing my own research, i found that there are a lot of users blocked in cloudflare. How to solve this issue?
17 Replies
Sounds like your function may be internally erroring then? I would tail the function to see if you can't get more info. Is it possible you're blocking your own server-side rendering from requesting an api or something
?pages-logs
If you're looking to tail a Pages Function you can do so in the UI here: https://dash.cloudflare.com?to=/:account/pages/view/:pages-project/:pages-deployment/functions
or with Wrangler:
wrangler pages deployment tail [deploymentId/url]
under Security -> Events you can get more specifics on blocks as well. IP Blocks of that kind are Security -> WAF -> Tools -> IP Access Rules
I saw a lot of IP in IP Access Rules, how do I know which IP from my cloudflare pages server? @Chaika
2a06:98c0:3600::103
is used for cross-cloudflare worker requests. It may be entirely unrelated to the blocks though, would try to tail to get more info on the internal errorsgot it, after trying tail, i got this error:
Something internal to your app. If it makes no sense to you, would just give generic advice like you would for any code failure, try rolling back to version before last if you can, try running locally, I believe with next-on-pages (which I assume you're using) they have some other way of running locally with wrangler pages dev, not sure if you're using or not. Try redeploying, etc
everything running well on my local, even if I try to build using next-on-pages the build is also success. that's why I have no idea it's not running only in cloudflare pages
did it ever work on pages?
yes, before it was working fine, just now it's failed, 1 years more running everything was fine
not sure if helpful but buildId is apparantly something you can set in config: https://nextjs.org/docs/app/api-reference/next-config-js/generateBuildId
I don't have too much experience with next on pages/nextjs though, can only google and guess/look at past messages
next.config.js Options: generateBuildId | Next.js
Configure the build id, which is used to identify the current build in which your application is being served.
@Chaika I tried to set build id based on your link, not work. I think i found the issue, that the build is run often because some hooks, it cause storage limit inside cloudflare pages, how to make some space inside?
Pages doesn't have a storage limit that goes across builds
It's possible that one of those automated builds updated a dependency and broke it or something, could try to find a commit that broke it
I found above these builds are errors, it's still in the same commit hash, just different deployment, not sure why, i just rollback to this version build at the moment
depends what your app does internally for the build as well. If your build command uses the latest version of a specific package which got bumped 7 hours ago, etc.
Seems like it might be an issue with the latest version of nextjs, I'm getting the same error when upgrading next from 14.2.5 to 14.2.11 (https://github.com/compute-toys/compute.toys/pull/126)
GitHub
Bump next from 14.2.5 to 14.2.11 by dependabot[bot] · Pull Request ...
Bumps next from 14.2.5 to 14.2.11.
Release notes
Sourced from next's releases.
v14.2.11
[!NOTE]
This release is backporting bug fixes. It does not include all pending features/changes on...
Yes @davidar i found the issue when nextjs version upgrade from 14.2.7 to 14.2.8, i just rollback to the old version, I think it’s related to the cloudflare pages