Skip to content

Server not reachable: unauthorized: master key is required #2349

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
zhangwb1996 opened this issue Dec 8, 2022 · 12 comments
Closed

Server not reachable: unauthorized: master key is required #2349

zhangwb1996 opened this issue Dec 8, 2022 · 12 comments

Comments

@zhangwb1996
Copy link

Hello!
i install parse-dashboard and parse-server on ubuntu server according to Deploying on AWS EC2 Ubuntu using PostgreSQL.then, parse-dashboard works well.
Then i install parse-server from source code and run npm start -- --appId UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV --masterKey BOyE27IdB8GKT0Jw5nTUmqoSWDfBAdc6PCOwCwqM --databaseURI postgres://postgres:[email protected]:5432/postgres --serverURL http://192.168.101.5:1337/parse on windows, parse-server startup without any error.
But when i restart parse-dashboard and login,the parse-server from source show one Error:

Error: unauthorized: master key is required
    at promiseEnforceMasterKeyAccess (C:\...\parse-server\lib\middlewares.js:450:19)
    at C:\...\parse-server\lib\PromiseRouter.js:85:20
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

and the page of parse-dashboard show: Server not reachable: unauthorized: master key is required
image

there are json files:
parse-dashboard-config.json on ubuntu server

{
  "apps": [
    {
      "serverURL": "http://192.168.101.104:1337/parse",
      "graphQLServerURL": "http://192.168.101.104:1337/graphql",
      "appId": "01",
      "masterKey": "12345678",
      "appName": "parse-server-app",
      "allowInsecureHTTP": "true",
      "iconName": "",
      "primaryBackgroundColor": "",
      "secondaryBackgroundColor": ""
    },
    {
      "serverURL": "http://192.168.101.5:1337/parse",
      "graphQLServerURL": "http://192.168.101.5:1337/graphql",
      "appId": "UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV",
      "masterKey": "BOyE27IdB8GKT0Jw5nTUmqoSWDfBAdc6PCOwCwqM",
      "appName": "parse-server-from-source",
      "allowInsecureHTTP": "true",
      "iconName": "",
      "primaryBackgroundColor": "",
      "secondaryBackgroundColor": ""
    }
  ],
 "users": [{
                "user": "admin",
                "pass": "123456",
                "apps": [{"appId": "01"},{"appId": "UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV"}]
        }],
  "iconsFolder": "public",
  "trustProxy": 1
}

config.json on ubuntu server

{
  "serverURL": "http://192.168.101.104:1337/parse",
  "appId": "01",
  "masterKey": "12345678",
  "appName": "parse-server-app",
  "cloud": "./cloud/main",
  "databaseURI": "postgres://postgres:123456@localhost:5432/postgres"
}

config.json from source on windows,(maybe it doesnt work)

{
  "serverURL": "http://192.168.101.5:1337/parse",
  "appId": "UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV",
  "masterKey": "BOyE27IdB8GKT0Jw5nTUmqoSWDfBAdc6PCOwCwqM",
  "appName": "parse-server-from-source",
  "cloud": "./cloud/main",
  "databaseURI": "postgres://postgres:[email protected]:5432/postgres"
}
@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 8, 2022

Thanks for opening this issue!

  • ❌ Please edit your post and use the provided template when creating a new issue. This helps everyone to understand your post better and asks for essential information to quicker review the issue.

@dblythy
Copy link
Member

dblythy commented Dec 9, 2022

You might need to set masterKeyIps depending on your Parse Server version

parse-community/parse-server#8316

@zhangwb1996
Copy link
Author

@dblythy Thanks for your answer.

Maybe,i have solved this error by run npm start in the dir generated after run bootstrap.sh.

PS C:\...\parse-server\parse-server-from-source> npm start

> start
> parse-server config.json
> .....

This error occurred, when i run npm in parse-server

PS C:\...\parse-server> npm start -- --appId UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV --masterKey BOyE27IdB8GKT0Jw5nTUmqoSWDfBAdc6PCOwCwqM --databaseURI postgres://postgres:[email protected]:5432/postgres --serverURL http://192.168.101.5:1337/parse 

> [email protected] start
> node ./bin/parse-server --appId UE7SmtidKby874Q8l2Vaq0FWFu5k6lcUiPisAEnV --masterKey BOyE27IdB8GKT0Jw5nTUmqoSWDfBAdc6PCOwCwqM --databaseURI postgres://postgres:[email protected]:5432/postgres --serverURL http://192.168.101.5:1337/parse 
> ....

@zhangwb1996
Copy link
Author

You might need to set masterKeyIps depending on your Parse Server version

parse-community/parse-server#8316

Thanks, i solved it by adding the startup param: --masterKeyIps 192.168.101.5
image

@mtrezza
Copy link
Member

mtrezza commented Dec 9, 2022

Can we improve anything in the error message here to make this clearer for the developer? I think this is the 3rd issue I came across recently where masterKeyIps was not set properly.

@mtrezza mtrezza reopened this Dec 9, 2022
@dblythy
Copy link
Member

dblythy commented Dec 9, 2022

Could we add a log to the server side such as attempted to connect with a valid masterKey but from an invalid IP: ip. Add ip to config option masterKeyIps to allow this request

@mtrezza
Copy link
Member

mtrezza commented Dec 9, 2022

Yes, I think it's good to keep it deliberately ambiguous and only log server side.

Request using master key rejected as the request IP address '1.2.3.4' is not set in Parse Server option 'masterKeyIps'.

@mtrezza
Copy link
Member

mtrezza commented Dec 9, 2022

@zhangwb1996 just a note that your post above includes sensitive information such as master key; if you decide to publish your app it would be good to change these keys.

@zhangwb1996
Copy link
Author

@zhangwb1996 just a note that your post above includes sensitive information such as master key; if you decide to publish your app it would be good to change these keys.

its ok, this is a demo for starting parse-server

@zhangwb1996
Copy link
Author

zhangwb1996 commented Dec 13, 2022

this error occured again today,

solved by adding a matched startup param: --clientKey XXXXXXXX

@mtrezza
Copy link
Member

mtrezza commented Dec 14, 2022

This will be fixed by parse-community/parse-server#8351

@mtrezza
Copy link
Member

mtrezza commented Dec 16, 2022

Closing via parse-community/parse-server#8351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants