codesandbox/sandpack

Sandpack Next.js Template Fetch With Body Fails

Opened this issue · 0 comments

Bug report

Hitting a problem with fetch on the Next.js template. When I comment out the body param it works, but it stalls when I add it in. Any ideas on how to fix this?

const response = await fetch('/api/backendRoute', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({"asdf": "asdf"})
});      

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

Unable to make fetch requests with a body param.