Skip to content

Listening on 127.0.0.1 raises a warning #7763

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

Closed
4 tasks done
marvinroger opened this issue Jan 3, 2022 · 5 comments
Closed
4 tasks done

Listening on 127.0.0.1 raises a warning #7763

marvinroger opened this issue Jan 3, 2022 · 5 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@marvinroger
Copy link
Contributor

New Issue Checklist

Issue Description

This was already raised in #4506, but the issue was closed.
When I start my Parse server listening on 127.0.0.1, I have the following warning:

  console.warn
    
    WARNING, Unable to connect to 'http://127.0.0.1:14744/api'. Cloud code and push notifications may be unavailable!
    

      at node_modules/parse-server/src/ParseServer.js:332:21

  console.warn
    Response: Error: connect ECONNREFUSED 127.0.0.1:14744
        at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1146:16) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 14744
    }

The problem comes from these lines: https://github.com/parse-community/parse-server/blob/alpha/src/ParseServer.js#L207-L209

There's a race condition here. When the app is mounted, the underlying server might not be listening yet.
When listening on localhost, the warning is not raised because of the DNS resolution (either on the listen or on the verifyServerUrl call), which takes some time. But when using an IP, like 127.0.0.1, the DNS resolution is skipped, the request from verifyServerUrl is done straight away, and the server is not yet listening, resulting in the warning.

I am not sure what can be done here (mount is not the right event to listen to, listening would be perfect, but this event does not exist from within a "sub" express app), except from removing this side-effect.

Steps to reproduce

Listen a Parse server with a server URL of 127.0.0.1

Actual Outcome

A warning

Expected Outcome

No warning

Environment

Server

  • Parse Server version: 4.10.4
  • Operating system: macOS 12.1
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added state:needs-investigation type:bug Impaired feature or lacking behavior that is likely assumed labels Jan 3, 2022
@needpower
Copy link

@marvinroger I have the similar type of issue, but with localhost

WARNING, Unable to connect to 'https://parse-platform:1337/parse'. Cloud code and push notifications may be unavailable!

The important thing is that warning happens only when parse-server runs inside a Docker container.
But i can directly access to parse-server with REST API, for example:

POST https://localhost:1337/parse/classes/_User

So question here: where is the best place to ask for help/ideas how to resolve this? I'm not sure wether this is a problem in parse-server, or docker, or in my docker-compose configuration.

@needpower
Copy link

@marvinroger Hello!
Any news or updates on that?

@marvinroger
Copy link
Contributor Author

Hi @needpower
I ended up creating an express app, bind it, then mounting the Parse server express app on it. Therefore, the server is already listening on Parse mount, and the warning is not raised 😉

@mtrezza mtrezza added the bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) label Nov 17, 2023
@mtrezza
Copy link
Member

mtrezza commented Nov 17, 2023

A note for Parse Server 6; it's important to await starting Parse Server before adding it to the express app:

const parseServer = new ParseServer({ ... });
const expressApp = express();
await parseServer.start();
expressApp.use('/parse', parseServer.app);

Asynchronous start of Parse Server has been introduced with Parse Server 6; this issue was reported for Parse Server 4 and any version below Parse Server 6 is unsupported at this time, hence I'm closing this issue.

@mtrezza mtrezza removed the bounty:$10 Bounty applies for fixing this issue (Parse Bounty Program) label Nov 17, 2023
@mtrezza mtrezza closed this as completed Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants