Next.js Discord

Discord Forum

Shiki (createHighlighter) breaks nested server action.

Answered
alfonsüs ardani posted this in #help-forum
Open in Discord
Environment
Next.js 15.5.5, next dev, macos

Description
Calling await createHighlighter in a server component with nested server action breaks the server action when button is clicked.

Steps to Reproduce
1. Create next app project
2. Create inline server action in a form with button
3. Define another server action that gets called inside the inline form server aciton
4. Install shiki, call createHighlighter in same component
5. npm run dev, click button

Error Log
 ⨯ unhandledRejection:  [TypeError: Cannot read properties of undefined (reading 'bind')]


Code
import { createHighlighter } from "shiki"

export default async function Home() {

  async function action() {
    "use server"
    console.log("Hello World")
  }

  await createHighlighter({ themes: [], langs: [] })
  // Comment this line to make it work again

  return (
    <form action={async () => {
      "use server"
      await action()
    }}>
      <button>Do it</button>
    </form>
  )
}
Answered by alfonsüs ardani
its fixed in Next.js 16 canary :bruh:
View full answer

1 Reply

its fixed in Next.js 16 canary :bruh:
Answer