vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.28k stars 26.77k forks source link

Error 500 When Deployed #14823

Closed iyansr closed 4 years ago

iyansr commented 4 years ago

Bug report

Describe the bug

My Website get throw 500 error when visiting the page that contain API calls from Strapi API, API call come from getServerSideProps

I tried running production on local with Production Strapi API that hosted on Heroku, and i works as expected. But when deployed to Vercel, and visit the page that contain API calls from Strapi API, it will throw 500 error.

To Reproduce

  1. Visit: https://iyansr.id/blog or https://iyansr.id/work

Expected behavior

Not Throwing 500 error

Screenshots

Deployed version : image

Running Production On Local : image

System information

Additional context

vercel.json

{
   "build": {
      "env": {
         "NEXT_PUBLIC_CONTENTFUL_SPACE_ID": "@contentful_space_id",
         "NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN": "@contentful_access_token",
         "NEXT_PUBLIC_MIXPANEL_TOKEN": "@mixpanel_token",
         "NEXT_STRAPI_URL": "@strapi_url1"
      }
   }
}

Vercel Logs

23:28:12.462  Cloning github.com/iyansr/iyansr.id-reborn (Branch: master, Commit: 23b7a35)
23:28:13.025  Cloning completed in 562ms
23:28:13.025  Analyzing source code...
23:28:15.341  Installing build runtime...
23:28:15.753  Build runtime installed: 411.862ms
23:28:16.633  Installing dependencies...
23:28:16.845  yarn install v1.22.4
23:28:16.907  warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
23:28:16.909  [1/4] Resolving packages...
23:28:17.900  warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
23:28:17.900  warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
23:28:18.750  [2/4] Fetching packages...
23:28:27.223  info fsevents@1.2.13: The platform "linux" is incompatible with this module.
23:28:27.223  info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
23:28:27.225  info fsevents@2.1.3: The platform "linux" is incompatible with this module.
23:28:27.225  info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
23:28:27.238  [3/4] Linking dependencies...
23:28:27.245  warning " > react-image@4.0.2" has unmet peer dependency "@babel/runtime@7".
23:28:27.245  warning " > babel-plugin-inline-react-svg@1.1.1" has unmet peer dependency "@babel/core@^7.0.0".
23:28:30.750  [4/4] Building fresh packages...
23:28:32.328  success Saved lockfile.
23:28:32.332  Done in 15.49s.
23:28:32.360  Running "yarn run build"
23:28:32.616  yarn run v1.22.4
23:28:32.638  $ next build
23:28:33.202  Creating an optimized production build...
23:28:33.217  Attention: Next.js now collects completely anonymous telemetry regarding usage.
23:28:33.218  This information is used to shape Next.js' roadmap and prioritize features.
23:28:33.218  You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
23:28:33.218  https://nextjs.org/telemetry
23:28:34.267  > Using external babel configuration
23:28:34.268  > Location: "/vercel/13874c42/.babelrc"
23:28:54.126  Compiled successfully.
23:28:54.126  Automatically optimizing pages...
23:28:54.774  Page                                                           Size     First Load JS
23:28:54.775  ┌ λ /                                                          3.69 kB         101 kB
23:28:54.775  ├   /_app                                                      2.12 kB        88.3 kB
23:28:54.775  ├ ○ /404                                                       2.55 kB        90.8 kB
23:28:54.775  ├ ○ /about                                                     621 B          94.2 kB
23:28:54.775  ├ λ /blog                                                      1.2 kB          179 kB
23:28:54.775  ├ λ /blog/[slug]                                               298 kB          471 kB
23:28:54.775  └ λ /work                                                      1.95 kB        99.7 kB
23:28:54.775  + First Load JS shared by all                                  88.3 kB
23:28:54.775    ├ static/pages/_app.js                                       2.12 kB
23:28:54.775    ├ chunks/05d954cf.b74ced.js                                  15.7 kB
23:28:54.775    ├ chunks/a804ac98b3e869f57a5ae5174dd192562465b93c.bb0d28.js  12.5 kB
23:28:54.775    ├ chunks/commons.346842.js                                   10.7 kB
23:28:54.775    ├ chunks/framework.619a4f.js                                 40.3 kB
23:28:54.775    ├ runtime/main.23c746.js                                     6.23 kB
23:28:54.775    ├ runtime/webpack.c21266.js                                  746 B
23:28:54.775    └ css/8745b9ae5553f958797a.css                               5.49 kB
23:28:54.775  λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
23:28:54.775  ○  (Static)  automatically rendered as static HTML (uses no initial props)
23:28:54.776  ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
23:28:54.854  Done in 22.24s.
23:28:59.964  Traced Next.js serverless functions for external files in: 5092.793ms
23:29:01.054  Compressed shared serverless function files: 1089.782ms
23:29:01.327  All serverless functions created in: 272.400ms
23:29:01.570  Uploading build outputs...
23:29:07.198  Build completed. Populating build cache...
23:29:13.626  Uploading build cache [26.30 MB]...
23:29:14.150  Build cache uploaded: 524.238ms
23:29:14.164  Done with "package.json"
ronaldruzicka commented 4 years ago

@iyansr please, how did you solve this issue? I'm having a similar problem. I have getServerSideProps on my pages, I need the data before I render the page. I have a Strapi API, all works good on localhost, but when I deploy I get 500 Internal server error. I can't figure out what to do.

Any help would be appreciated! 🙏

Thanks!

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.