fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

Does not work on heroku #136

Closed developer239 closed 6 years ago

developer239 commented 6 years ago

Localhost production and development works fine though.

This is my server.js:

const express = require('express')
const next = require('next')

const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const routes = require('./routes')
const handler = routes.getRequestHandler(app)

app.prepare().then(() => {
  express().use(handler).listen(port)
})

These are my scripts:

"scripts": {
    "dev": "node server.js",
    "build": "next build",
    "start": "NODE_ENV=production node server.js",
    "heroku-postbuild": "next build"
  },

This is my procfile:

web: npm start -- --port $PORT

These are my config variables:

NPM_CONFIG_PRODUCTION=false

image

fridays commented 6 years ago

It doesn't look like a problem with this library. Does it work with only Next.js?

fridays commented 6 years ago

Maybe related? https://github.com/zeit/next.js/pull/3704

developer239 commented 6 years ago

Sorry I managed to fixed it. It was actually problem with nextjs.

https://stackoverflow.com/questions/48713444/nextjs-5-0-0-heroku-internal-server-error