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

Error when adding new file with NextJS template: "TypeError: Arguments must be Buffers" #777

Closed
1 of 2 tasks
paul-berthelot opened this issue Feb 28, 2023 · 1 comment · Fixed by #778
Closed
1 of 2 tasks
Labels
bug Something isn't working triage New issues that needs consideration

Comments

@paul-berthelot
Copy link

Bug report

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

When I try to add a new file with NextJS template, I get this error:
TypeError: Arguments must be Buffers.
But it works fine with the React template. The error is maybe due to the new nodebox version?

The error occured when I call the addFile function:

sandpack.addFile("/myFile.ts", "test");

I tried to change the extension of the new file, the path and the value, but I always get the same error.

When I debug with Safari, I saw that there is a buffer compare function that takes 2 arguments 'a' and 'b'.
The compare function is run for each file and every one works except the new File. We can see that the 'a' buffer seems to work with the "test" value translated in an array: [116, 101, 115, 116]. But the 'b' buffer is undefined unfortunately. So it throws the error: "Arguments must be Buffers".

Screenshot 2023-02-28 at 15 54 53

Thank you for any help!

Your Environment

dependencies: {
"@codesandbox/sandpack-react": "^2.0.17",
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0"
}

Don't work on Arc, Chrome and Safari.
MacOS Ventura 13.1

@paul-berthelot paul-berthelot added bug Something isn't working triage New issues that needs consideration labels Feb 28, 2023
@danilowoz
Copy link
Member

Thanks for reporting! It should be fixed soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that needs consideration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants