Skip to content
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

NextJS SDK lru-cache error #3422

Open
bmstefanski opened this issue Jul 15, 2024 · 5 comments
Open

NextJS SDK lru-cache error #3422

bmstefanski opened this issue Jul 15, 2024 · 5 comments
Assignees

Comments

@bmstefanski
Copy link

bmstefanski commented Jul 15, 2024

Describe the bug
I started using new experimental nextjs SDK since our app doesn't make sense without RSC and we want to use builder. There's sadly no workaround I know that would allow us to use server components & have drag-and-drop custom components. If you know some workaround for now, please let me know! :)

To Reproduce
Steps to reproduce the behavior:

  1. Set up the app like the example here https://github.com/BuilderIO/builder/blob/main/packages/sdks/output/nextjs/README.md#examples
  2. Yarn install & yarn dev and the error with lru-cache appears

Expected behavior
Should work with RSC

Screenshots
image

Additional context

My next.config.js

  reactStrictMode: true,
  transpilePackages: ["@builder.io/sdk-react-nextjs"],
  experimental: {
    serverComponentsExternalPackages: ["isolated-vm"],
  },
  // removed for brevity
 

I also tried adding lru-cache to serverComponentsExternalPackages, but that didn't help. I have isolated-vm and lru-cache installed locally.

It also doesn't matter whether I set up any custom components in <Content />. It throws the same error even if it's empty

I tested it on the same versions (next, react, react-dom, sdk) as in the example and also on the newest (0.15.1).

Node.js version: 20.x

Thanks in advance!

@samijaber
Copy link
Contributor

Thanks for filing. Our example repository that lives at https://github.com/BuilderIO/builder/tree/main/examples/next-js-sdk-gen-2-experimental-app-directory is continuously deployed on Vercel to make sure its build works properly.

The latest version is live at https://nextjs-sdk.vercel.app, grabbing the current code from the main branch.

The Vercel server is configured with Node.js 20.x and other versions respect whatever is in package-lock.json and package.json.

The repo should work as-is without any modifications. Have you made any additions or changes to the app? Could you share a fork/reproduction repo that reproduces the build error?

@bmstefanski
Copy link
Author

Thank you for quick response, I will build a small reproduction app today and post it here

@bmstefanski
Copy link
Author

I downloaded the example and replaced npm with yarn and used Node 20.11.1 (nvm use 20.11.1 ) and now it exists the process of yarn dev whenever I visit any route. When I go back to 18.17.0 it seems to work fine in that example.

Repo: https://github.com/Blazity/builder-nextjs-sdk-repro

@samijaber
Copy link
Contributor

@bmstefanski Thank you for the reproduction. We are able to reproduce the issue, and have identified the root cause(s).

Will share here when a fix is made.

Thank you for your patience 🙏🏽

@samijaber samijaber self-assigned this Aug 20, 2024
@Rudolf-Dudarev
Copy link

Subscribing for the update. Great communication by builder.io team, thanks for the effort! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants