Open jfbaraky opened 1 year ago
I don't know if this is related, but building with standalone: true
and serving with node server.js
on my local machine also has the same issue, it works sometimes after a server restart but that should not be the case.
I don't know about Vercel but both on local and hosted with Docker the revalidate does not work.
I set a const export revalidate = 3600
the revalidation after 1h works but when I try to force with my revalidate endpoint it does nothing.
Edit: tried with both 13.2.4 and 13.2.5-canary.16
For now, I'll leave the revalidate with only 5 seconds and wait for the fix :/
Does someone have any update on this?
Bump. Running into the same issue!
I have a similar issue.
On demand revalidation does not work on vercel. I get the error:
Invalid response 200
No additional log messages on why.
Using next 13.4.1
Locally it works as intended.
Using nextjs 13.2.4 and getting an error when making a request to the revalidate endpoint 😢
2023-05-25T20:37:52.825Z undefined ERROR Cannot find module 'next/dist/server/next-server.js'
Require stack:
- /var/task/___next_launcher.cjs
2023-05-25T20:37:52.825Z undefined ERROR Did you forget to add it to "dependencies" in `package.json`?
RequestId: xxxxx-xxxx-xxxx-xxxxx Error: Runtime exited with error: exit status 1
Runtime.ExitError
It only happens in vercel, in local/development it works correctly 😭
Any updates on this?
I'm facing the same issue when deploying to Vercel, locally works as spected (pages router):
Error: Failed to revalidate /content/[slug]: Invalid response 200
at z (/var/task/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:11496)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async o (/var/task/.next/server/pages/api/revalidate.js:1:650)
at async K (/var/task/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)
at async U.render (/var/task/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)
at async r2.runApi (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:42106)
at async r2.handleCatchallRenderRequest (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:36819)
at async r2.runImpl (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:16:17133)
at async r2.handleRequestImpl (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:16:16226)
at async Server.<anonymous> (/var/task/___next_launcher.cjs:27:5)
Verify canary release
Provide environment information
Link to the code that reproduces this issue
https://www.digitalocean.com/community/questions/next-js-on-demand-revalidation-not-working-on-digitalocean-app-platform
To Reproduce
export default async function handler(req: NextApiRequest, res: NextApiResponse) { // Checking for available method if (req.method !== 'POST') { return res.status(404).json({ error:
Invalid method ${req.method}
}); }// Checking body if (!req.body.subdomain) { return res.status(401).send({ error: 'Missing subdomain on body' }); }
// Revalidating route try { await res.revalidate(
/${req.body.subdomain}
); // Next.js method to recreate static pages} catch (error) { res.status(500).json({ error, headers: req.headers }); } }