Skip to content

TypeError: Cannot read properties of undefined (reading 'split') after configuring ppr experimental feature in nextjs 15 #33

@tonyabracadabra

Description

@tonyabracadabra
 TypeError: Cannot read properties of undefined (reading 'split')
    at JSON.parse (<anonymous>)
    at JSON.parse (<anonymous>)
    at JSON.parse (<anonymous>)
    at JSON.parse (<anonymous>)
    at JSON.parse (<anonymous>)
    at JSON.parse (<anonymous>)
digest: "3168819825"

Got the error above on

"next": "15.0.0-canary.76"
"react": "19.0.0-rc-512b09b2-20240718",
"contentlayer2": "^0.5.0",
import { useMDXComponent } from "next-contentlayer2/hooks";
import * as React from "react";

import { MdxCard } from "@/components/blog/mdx-card";
import { Callout } from "@/components/blog/callout";
import { cn } from "@/lib/utils";
import ClientTweetCard from "./client-tweet-card";
import Image from "next/image";

const components = {
  h1: ({ className, ...props }: any) => (
    <h1
      className={cn(
        "mt-2 scroll-m-20 text-4xl font-bold tracking-tight",
        className
      )}
      {...props}
    />
  ),
  h2: ({ className, ...props }: any) => (
    <h2
      className={cn(
        "mt-10 scroll-m-20 border-b pb-1 text-2xl font-semibold tracking-tight first:mt-0",
        className
      )}
      {...props}
    />
  ),
};

interface MdxProps {
  code: string;
}

export function Mdx({ code }: MdxProps) {
  const Content = useMDXComponent(code);

  return (
    <div className="mdx">
      <Content components={components} />
    </div>
  );
}

I think the problem is caused by configuring

const nextConfig = {
  experimental: {
    ppr: "incremental",
}
...

in next.config.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions