The script will never generate a response in GenerateMetadata with fetch() NextJS14

I am getting the error The script will never generate a response when trying to use fetch() in my generateMetaData function in NextJS 14. I’ve seen a lot of similar bugs reported on this but haven’t been able to find a solution. Is anyone familiar with this? I can reproduce this locally when running npx @Cloudflare/next-on-pages@1 and then using wrangler to do a preview, otherwise this works on local. The error I was getting before reproducing on local (in my dev cloudflare url) was A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.

Using thise code trying to fetch data for SEO Functions: generateMetadata | Next.js

1 Like

This error doesn’t say much on how to solve the issue, I’m encountering this on most of dynamic generated pages that use the generateMetaData with NextJS14.2.3 function as well.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.