fab-spec/fab

after first load not work nextjs api on cloudflare workers

HardCoreQual opened this issue · 2 comments

I create simple nextjs app with api
deploy on cloudflare workers
open site in browser - api work
reopen site or refresh tab - api not work

test.zip
add in fab.config.json5 your cloudflare account_id and token
npm run next build && npm run fab build && npm run fab deploy

Hey there, this is a nasty bug with a simple fix:

// api/your-endpoint.js

export default (req, res) => {
  // your existing route code here
}

// Add this export:
export const config = {
  api: {
    bodyParser: false,
  },
}

From the config documented here

(If you're interested, this took a bunch of investigation which you can read about in #252)

Thank you!