-
Notifications
You must be signed in to change notification settings - Fork 44
[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 |
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: