Skip to content
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

set hostname to 0.0.0.0 #54342

Merged
merged 3 commits into from Aug 21, 2023
Merged

set hostname to 0.0.0.0 #54342

merged 3 commits into from Aug 21, 2023

Conversation

m4salah
Copy link
Contributor

@m4salah m4salah commented Aug 21, 2023

When I try to deploy to Google Cloud Run it fails after some investigation I saw this line in

.next/standalone/server.js

const hostname = process.env.HOSTNAME || 'localhost'

This some how make this log when i run docker

- ready started server on 172.17.0.2:3000, url: http://172.17.0.2:3000

I don't know why it's logging this address even if the server running on localhost.

So this my fix
Set hostname to 0.0.0.0 to avoid deployment failing on Google cloud run.

Set hostname to 0.0.0.0 to avoid deployment failing on Google cloud run
@m4salah m4salah requested review from a team as code owners August 21, 2023 16:10
@ijjk ijjk added the examples Issue/PR related to examples label Aug 21, 2023
Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
passed Passed Secrets high 0  medium 0  low 0  info 0

@timneutkens timneutkens merged commit b7eb6d4 into vercel:canary Aug 21, 2023
6 of 9 checks passed
@deback
Copy link

deback commented Aug 28, 2023

I have added a healthcheck.
"HEALTHCHECK --interval=30s --timeout=10s CMD curl -f http://localhost:3000/api/healthcheck || exit 1"

It worked before the change. Now the healthcheck stays in the status (health: starting) for almost two minutes. after that the docker container is (unhealthy).
What can be the reason for this

@maitrungduc1410
Copy link

this breaks my Next Auth flow also, as I described here: nextauthjs/next-auth#8535

somehow the hostname is my container private IP and not its hostname

So I have to downgrade from 13.4.19 -> 13.4.12, it its fine now

kodiakhq bot pushed a commit that referenced this pull request Sep 14, 2023
By default Next.js listens on localhost, platforms like Google Cloud Run and fly.io will fail to deploy apps that listen on `localhost`, Next.js should bind to `0.0.0.0` instead

Related to #54342
Fixes #49777
Fixes #54133
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants