-
Notifications
You must be signed in to change notification settings - Fork 45
[BUG] Error: Invariant: renderHTML should not be called in minimal mode #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
hmm, have a feeling it might be either way the error message coming out doesn't help me to RCA this. I did notice other endpoints which import the atprotoOauthClient (which imports dotenv) are also throwing 500 errors with the same error message edit, edit2, I've done a bunch of edits to simplify things, still seeing the same error out of what I suspect is the ATProto package(s), I wonder if they are using some unsupported |
linking in #57 |
refactored more code, per issue 57
still seeing the same issue. Wondering if it is similar to NextAuth because we are doing OAuth with this package: https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client-node |
I am also facing the same issue and I am not even using |
Here is a minimal reproducer: https://github.com/verdverm/cf-repro |
Thanks, |
thanks, keep me posted, I have one more thing I want to try (a hacky shim for one of the packages I'm using for ATProto) It certainly seems like this |
Some additional context, issues, and workarounds w.r.t. ATproto OAuth on Cloudflare Workers |
Was also hitting this and I finally narrowed it down to a import { headers } from 'next/headers';
export default async function NotFound() {
const headersList = await headers();
console.log(headersList);
return (
<div>
<h2>Not Found</h2>
<p>Could not find requested resource</p>
</div>
);
} This code is pretty much straight from the next.js docs for creating a not found page. It's the |
My not found is much simpler, has always been this, including with my error above const NotFound = () => {
return (
<div>
<div className="py-24 flex flex-1 w-full justify-center space-x-8">
<span className="font-light text-gray-600 italic text-3xl pt-4">
404 - Not Found
</span>
</div>
</div>
)
}
export default NotFound |
I am getting this error when nextjs runs the API's in |
@gethassaan it is almost certainly a specific library or function you are using. I have routes in I've also been able to make progress by removing my ORM and using the D1 bindings and handwritten SQL instead. Prisma is broken for me, as is ATProto OAuth library (i'm using passwords for now, while I wait for a fix here, which should give me a better error so I know what is actually going wrong) |
I created a demo application in Next.js with a simple POST API route, without using any additional libraries or packages. It runs perfectly fine during development and build time without Wrangler. However, when running in preview mode, I encounter the error mentioned in the issue title, and I'm not sure why. Here is the project link if you'd like to take a look. I haven't removed anything, so you should be able to understand the setup. Nothing in the code is confidential. 🔗 Project Link: https://github.com/P4rthPat3l/nextjs-isr-demo |
Hello, I’m encountering the same issue. It appears that the |
Looks like it's intentionally set to
this appears to be the source of the issue. A more effective approach could be:
unless |
The commit which adds it: 49da40b#diff-ddd7be9cd497c3ddbc894be57f481bf451e45f82201cc28f1c1bce4c5291b52c |
Some more context: https://github.com/search?q=repo%3Avercel%2Fnext.js%20NEXT_MINIMAL&type=code Looks like it largely controls how imports/requires are handled |
I wonder if this comment from 2021 still holds true: vercel/next.js#29801 (comment) Discovered from: vercel/next.js#75102 |
|
I checked the nextjs code i found that probably the
locally that code works by redirecting me to the kinde login page, but due this issue the I'm testing my theory. |
after upgrade to nextjs 15.2.0, i faced the same error. My old project hasn't been touched for a long time; I've only updated the Next.js version. However, there are still no issues with versions 15.1.7 or 15.1.6. |
I am seeing this issue for all api requests and happens after I upgraded nextjs from 15.1.7 to 15.2.0 |
Facing same issue here, i can confirm that next 15.1.6 doesnt have this issue |
@vicb still seems like the real error is being hidden. I'm now seeing
Though the third line on the minified stack trace looks to indicate it wants to return a string about an unsupported api usage (which is what I expect the real error to be) I updated wrangler and opennext to the latest in my repro: https://github.com/verdverm/cf-repro |
I am also facing the same issue. |
Thanks for your feedback @verdverm, we will take a look |
I've been looking into that a bit. When the route (It looks like the route requires |
@verdverm Could you please try to build your app with import process from "node:process";
Object.assign(process.versions, {node: "18.0.0"});
Object.assign(process, {version : "v18"}); at the top of Details:
|
@vicb, I updated wrangler and opennextjs, still seeing a 500. Did confirm it still works in local dev mode (this is using the actual application rather than the reproducer, but should be equivalent)
The first line where the undefined
|
Is there a chance you can update the repro? |
@verdverm try adding the following to your wrangler.json: "define": {
"process.version": "\"v22.14.0\"",
"process.versions": "{ \"node\": \"22.14.0\" }"
}, It's likely you're running into this: auth0/node-auth0#1027 (comment) |
If that doesn't work, you can debug further like this (we'll make this easier in the future):
+ } catch (e) {
+ console.error(e);
+ throw e;
} finally {
process.env.__NEXT_PRIVATE_RUNTIME_TYPE = "";
}
This time around, you should be able to see the root cause error, that's preventing this module from running correctly (which makes the |
@vicb updated the repro repository
still unable to see what the real underlying error is :[
I agree this is likely the underlying error. (based on comments here: bluesky-social/atproto#3292) |
Can you clarify what this means? It shouldn't log anything unless there's an error |
There were some other unrelated errors when the page or server loads (but seem to be handled gracefully elsewhere?), however when making the call with the known issue, it never reaches that part of the code (I assume, because that error print doesn't show) |
Hmmm, I'm suspicious of "seem to be handled gracefully elsewhere?" TBH. Can you expand on that? Like, what errors are we talking about? Any error logged from that spot that I said to add the |
I am geeting this error whenever nextjs makes an internal api request to fetch the images from S3 bucket |
The errors I see are (from the cf-repro project I created)
|
Right, so the real issue in that case is this then: cloudflare/workerd#3053 |
* adds cloudflare puppeteer support * fix broken CSS * try remove dynamic import * add caching * disable hls video element as its too large for cloudflare workers.. for now * bundle analyzer * try custom route for workers * close browser after use * add logging * close browser on caught error * upgrade opennextjs to fix opennextjs/opennextjs-cloudflare#234 * add public folder to repo. * dynamic import of puppeteer * logging and import fix * arg * asdfasdf * migrate puppeteer to use local chrome instead * conditinal import * adds cobalt2 theme for highlighting. Fixes #407 * WIP metadata * blog post meta tags * Image loader for cloudflare * custom omain * fallback quality * fix footer styling. closes #413 * worker + jpg * smaller * jpg * favicon formatting * square favicon * Stretch video. fixes #418 * Meta WIP * Meta WIP * Page meta WIP * js page to mdx * Move Shiki to singleton. Fixes #423 * Page Meta complete. I hope * fixes leaking global CSS for OG images * Meta tag finished * fix the types * cleanup * Sentry integreation * reinstate content navigation. Fix post cache * content Nav and page meta fixed * fix build * minor deps * migrate to initOpenNextCloudflareForDev. Make getCloudflareContext sync * adds twitter feed back in * Reinstates welcome image. Closes #428 * match nav * logs * fix images on localhost * not found * enable PPR and dynamic tips page * Upgrade opennextjs to fix dynamic require bug. opennextjs/opennextjs-cloudflare#347 * remove build skip * remove global cache to see if memory improves * disable instrumentation * try PR #354 to fix memory issues * reinstate instrumentation * reinstate global cache * global error page * remove patches * remove tunnel route * fix lockfile * reinstate patches * remove last bits of gatsby code * hRM * disable async metadata call * add workers domain to wrangler file * NVM * remove ppr * upgrade next canary * disable PPR * remove next import * revert to stable next * reinstate PPR * remove headers call from not-found. Causing RenderHTML Bug opennextjs/opennextjs-cloudflare#333 * Adds static gen for all blog posts and javascript notes pages * image compressor script * compresor script * compress images * adds minifiy to wrangler deploy * removes unused images * fake change to trigger cf * reinstate footer * PPR for footer blocks * revert next.js canary version * next stable * experimental ppr * force dynamic everyhting * make all pages dyanmic * remove old templates * toggle instrumentation * upgrade deps * override axios dependency to add fetch support * Creates MDX static export file * Last few commits before I switch to waku * move to waku * waku hono cache * Caching middleware * dynamic LAyout * dynamic contact page * disable cache * Implement caching wrapper with KV * Adds cache * PAge meta * clean up cache * image sizes are working! * unpic image component * eager * css codesplit * nice fontstack fallback * Smaller logo * add preload for fonts * add preload for fonts * inline source * revert * deps * codesplit * black grit is now a webp * preload webfonts * remove css codesplit * handsome preload * preload handsome * add width/height to footer image * font-display: swap; * accessibility * hard code logo size * asset caching * remove client provider as it was leaking server component into client * adds font fallback with proper sizing * adds logging for cache * cache RSC requests, plus about and contact pages * favicon * CDN-Cache-Control * favicon file * adds cache time header * Ugh * increase cache time * remove public * LCP home image * try larger image * disable grit * page speed hacks * put the grit back in * cachce * revert * upgrade image-size to 2.0 * cache * hrm * cache * x-cache-hit * asfd * cache * asdfasdf * cache * cache * cache * cache * return cache works, testing fix for initial work * tee body * tee body * no dupe * tee * change to CDN cache control * change to CDN cache control * adds cache tag and client TTL headers * adds git hash to cache key and cache tag * clean things up * OG images * home page og * removes next.js app directory * new nav * robots.txt * pagination * pagination title tags * git hash * error boundary testing * move break component * asdf * hono middleware * prod * order * tails * remove error * Fix types for css modules * adds social links. Fixes #427 * Static paths for blog posts. Fixes #436 * custom 404 * debugging x requests * Custom 404 page shenangins * env variables * dev + deploy env * fix image size inlining * REinstates page scrolling for JS notes. fixes #410 * add sounds on hover * sounds * new syntax artwork * Implement Biome as linter and formatter * formatting * Linting fixes * social links * error handling integration * mobile nav * removes caching onf 404, 403 and 500 pages * Update 50-mapping.mdx Fixed some of the capitalization for toUpperCase() function, the parentheses for order of operations in the age calculations, and the attribute in the person object. * Update 57-shopping-form-with-custom-events-delegation-and-localstorage.mdx Make sure that first argument sent to localStorage.setItem is a string. * Update 21-selecting-elements.mdx * fix syntax links * Removes border inline when kissing * Fixes edit links * removes error testing buttons * Upgrade to latest deps, migrate to waku string config * Page loading indicator * fix javascript notes scroling issues * LETS launch this sucker * upgrade deps * fix the build * Sourcemaps * Trying some new error logging * Trying some new error logging * logging * logging * reinstate create tip CLI * patch mediachrome to work on workers * analytics * Analytics logging * client component * readme * custom domain * sub * traiing slash redirect * error logging * add domain to traceProp * logging * try remove explicit reporting. I think the error boundary is catching * Migrate to router events API. Fixes #455 * upgrade wrangler * update wrangler * add github mcp * Update 50-mapping.mdx Fixed some of the capitalization for toUpperCase() function, the parentheses for order of operations in the age calculations, and the attribute in the person object. --------- Co-authored-by: Wes Bos <[email protected]> Co-authored-by: upendradhami <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I'm trying to make a post to the following NextJS API route and get this error back after the wrangler / opennext build. Not sure what's causing it
Steps to reproduce
Not sure yet, can get CF trace details
I can see about producing a minimal reproducer in the next couple of days
Expected behavior
I can post to oauth endpoint and not get errors
@opennextjs/cloudflare version
0.5.3
Wrangler version
3.109.2
next info output
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:23:36 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8112 Available memory (MB): 24576 Available CPU cores: 8 Binaries: Node: 21.7.1 npm: 10.5.0 Yarn: 1.22.21 pnpm: 8.14.0 Relevant Packages: next: 15.1.7 // Latest available version is detected (15.1.7). eslint-config-next: 15.1.0 react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.3 Next.js Config: output: standalone
Additional context
running site is at https://verdverm.verdverm.workers.dev
The text was updated successfully, but these errors were encountered: