Skip to content

[BUG] Error: Invariant: renderHTML should not be called in minimal modeΒ #333

@verdverm

Description

@verdverm

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

import { NextRequest, NextResponse } from 'next/server';
import { isValidHandle } from '@atproto/syntax'

import { client as atprotoOauthClient } from '@/lib/atproto/oauth/client'

type Session = { did: string }

export async function POST(req: NextRequest) {
  const data = await req.json()

  // Validate
  const handle = data.handle
  if (typeof handle !== 'string' || !isValidHandle(handle)) {
    return NextResponse.json({error: "invalid handle"})
  }

  // Initiate the OAuth flow
  try {
    const url = await atprotoOauthClient.authorize(handle, {
      scope: 'atproto transition:generic',
    })
    return NextResponse.json({ redirect: url.toString() })
  } catch (err) {
    return NextResponse.json({error: "oauth authorize failed", details: err, message: err.message})
  }
}

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions