Skip to content

Fix Heroku deployment guide #1591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2023
Merged

Fix Heroku deployment guide #1591

merged 1 commit into from
Apr 17, 2023

Conversation

peppix2010
Copy link
Contributor

The old server.js proposed doesn't work, please update with the following: module.exports = ({ env }) => ({
proxy: true,
host: "0.0.0.0",
port: process.env.PORT,
url: env('MY_HEROKU_URL'),
app: {
keys: env.array('APP_KEYS')
},
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET'),
},
},
})

What does it do?

Describe the technical changes you did.

Why is it needed?

Describe the issue you are solving.

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request

The old server.js proposed doesn't work, please update with the following:
module.exports = ({ env }) => ({
  proxy: true,
  host: "0.0.0.0",
  port: process.env.PORT,
  url: env('MY_HEROKU_URL'),
  app: { 
    keys: env.array('APP_KEYS')
  },
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET'),
    },
  },
})
@peppix2010 peppix2010 requested a review from pwizla as a code owner March 14, 2023 10:34
@vercel
Copy link

vercel bot commented Mar 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
documentation ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 14, 2023 at 10:37AM (UTC)

@strapi-cla
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

},
});
proxy: true,
host: "0.0.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could also set this as a env not that it needs to change.
But it would make it more dynamic.
We are also using process.env.PORT where we could make it more standard to say env("PORT") IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, problem is that the environment variables are set in the HEROKU settings dashboard, the current solution doesnt work when deploying the app in Heroku but it givves the following error:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
while the proposed change it works at least on Strapi version > 4.6.0

@pwizla pwizla self-assigned this Mar 14, 2023
@pwizla pwizla added pr: code fix PRs only fixing existing code examples source: Dev Docs PRs/issues targeting the Developer Docs labels Mar 14, 2023
@pwizla pwizla added this to the 2023-12: v4.8.1 milestone Mar 15, 2023
@pwizla pwizla added pr: chore and removed pr: code fix PRs only fixing existing code examples labels Mar 23, 2023
@pwizla pwizla modified the milestones: 2023-14, 2023-15, 2023-16 Apr 5, 2023
Copy link
Collaborator

@pwizla pwizla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @peppix2010!
It's approved, merged, should be live on docs.strapi.io in a few minutes, and will be mentioned in the next weekly snapshot release.

@pwizla pwizla merged commit 7d993a0 into strapi:main Apr 17, 2023
@pwizla pwizla changed the title Update heroku.md Fix Heroku deployment guide Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: chore source: Dev Docs PRs/issues targeting the Developer Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants