leerob / site

My site built with Next.js, Tailwind, and Vercel.
https://leerob.com
7.2k stars 1.39k forks source link

views api retrun error only on netlify #627

Closed c1j659 closed 1 year ago

c1j659 commented 1 year ago

I just deployed the repo to netlify, it reports an error when fetching 'api/views' , everything works fine in local using pnpm start . This issue only occurred when deploying to netlify. url is: https://frolicking-paletas-032413.netlify.app/blog

here is the api repsone: {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'styled-jsx'\nRequire stack:\n- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/build/webpack/require-hook.js\n- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/initialize-require-hook.js\n- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js\n- /var/task/.netlify/functions-internal/netlify-api-handler/netlify-api-handler.js\n- /var/task/_netlify-api-handler.js\n- /var/runtime/index.mjs","trace":["Runtime.ImportModuleError: Error: Cannot find module 'styled-jsx'","Require stack:","- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/build/webpack/require-hook.js","- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/initialize-require-hook.js","- /var/task/node_modules/.pnpm/next@13.2.5-canary.16_biqbaboplfbrettd7655fr4n2y/node_modules/next/dist/server/next-server.js","- /var/task/.netlify/functions-internal/__netlify-api-handler/netlify-api-handler.js","- /var/task/___netlify-api-handler.js","- /var/runtime/index.mjs"," at _loadUserApp (file:///var/runtime/index.mjs:997:17)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1032:21)"," at async start (file:///var/runtime/index.mjs:1195:23)"," at async file:///var/runtime/index.mjs:1201:1"]}

leerob commented 1 year ago

I don't believe Netlify supports the Next.js App Router yet 👍