-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(serve): fix server listening logs (#9894)
Right now logs from `yarn rw serve` are a bit deceiving. `yarn rw serve` sets `NODE_ENV` to `'production'` if it's not already set. This changes the host the server ends up listening on: https://github.com/redwoodjs/redwood/blob/97296d4c57e6dffb4eee2489397a3486d11e24fd/packages/cli/src/commands/serve.js#L195-L198 https://github.com/redwoodjs/redwood/blob/97296d4c57e6dffb4eee2489397a3486d11e24fd/packages/cli/src/commands/serveBothHandler.js#L125-L128 Basically, if a user doesn't set `NODE_ENV`, `yarn rw serve` serves everything at `'0.0.0.0'`. But we've hardcoded `'localhost'` in our logs: https://github.com/redwoodjs/redwood/blob/97296d4c57e6dffb4eee2489397a3486d11e24fd/packages/cli/src/commands/serveBothHandler.js#L136-L141 At first it doesn't appear wrong if you go to http://localhost:8910. It's there. But that's only because `'0.0.0.0'` means listen on all ipv4 addresses. This may seem like a small change but it's a bug if your server is listening on localhost in Docker and on deploy providers. When you look at the serve logs in a container, this is giving the impression that something is misconfigured when everything is actually fine. Instead let's just use the return from `fastify.listen` or `fastify.listeningOrigin` which tell us where it's listening. #### Before <img width="600" alt="image" src="https://github.com/redwoodjs/redwood/assets/32992335/87013982-02c8-4f1f-beae-acc6f95a3a87"> #### After <img width="600" alt="image" src="https://github.com/redwoodjs/redwood/assets/32992335/1df0d7c0-f02a-43d7-be80-9de1b522288e"> --------- Co-authored-by: Tobbe Lundberg <[email protected]>
- Loading branch information
Showing
11 changed files
with
86 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters