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

where i put appid ,masterKey in project and npm start not working....so plz help me #128

Closed
singh7889 opened this issue Feb 1, 2016 · 23 comments

Comments

@singh7889
Copy link

No description provided.

@christianmarth
Copy link

Can you please provide the error message you receive when you run npm start

@singh7889
Copy link
Author

DATABASE_URI not specified, falling back to localhost.

@singh7889
Copy link
Author

e:/parse-server-master
$ npm start
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v5.5.0
npm ERR! npm v3.3.12

npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! G:\parse\parse-server-master\npm-debug.log

@ghost
Copy link

ghost commented Feb 1, 2016

You are missing the start script from the package.json file:

"scripts": {
    "start": "node index.js"
 }

Or simply do node index.js without npm.

@gfosco gfosco closed this as completed Feb 1, 2016
@singh7889
Copy link
Author

hello #Iulianvarzaru sir,
its not working...
i am using parse-server-master not parse-server-example.
when i use parse-server-example then i got error---

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.

and in browser--
{"error":"unauthorized"}

so plz help ..

@ghost
Copy link

ghost commented Feb 2, 2016

Actually it's working but you have to put your application Id as a header in the request. Try:

curl -X POST \
  -H "X-Parse-Application-Id: myAppId" \
  -H "Content-Type: application/json" \
  -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
  http://localhost:1337/parse/classes/GameScore

@singh7889
Copy link
Author

#Iulianvarzaru

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.

In browser, if I go to "localhost:1337/parse", it gives me the following error. (localhost:1337 is fine)

{"error":"unauthorized"}

And this is my API setup. I did provide databaseURI but don't know why it is complaining that it is not specified.
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev',
appId: 'xxx',
masterKey: 'yyy'
});

@singh7889
Copy link
Author

curl -X GET
-H "X-Parse-Application-Id: XXX"
-H "X-Parse-Master-Key: YYYY"
http://localhost:1337/parse/classes/_User

we got error :---

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0cu rl: (7) Failed to connect to localhost port 1337: Connection refused

@ghost
Copy link

ghost commented Feb 3, 2016

Failed to connect to localhost port 1337: Connection refused, is mongodb running on your server ?

@singh7889
Copy link
Author

Yes , I got data in cmd but in browser i got error--
url:-http://localhost:1337/parse/
display- {"error":"unauthorized"}

@ghost
Copy link

ghost commented Feb 5, 2016

{"error":"unauthorized"} is thrown only when you don't provide the header keys inside your request. If you didn't setup any other keys like restApiKey or javascriptkey you just need to include your application id in the header. Maybe post here your server file so I can look into it.

@vineetbindal
Copy link

I am getting this error too "DATABASE_URI not specified, falling back to localhost". Where do I put the damn URI. Can anyone help please?

@ghost
Copy link

ghost commented Feb 8, 2016

This is not an error, it just says that there is no environment variable DATABASE_URI and that it's using the url from the server file.

@vineetbindal
Copy link

I Understand. But where do I put that variable. I tried in app.json. index.js and scalingo.json. none worked.

index.js have this

var api = new ParseServer({
//databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
databaseURI: databaseUri || 'mongodb://userName:Password@ds059165.mongolab.com:59165/parse_appDatabase',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppKey',
masterKey: process.env.MASTER_KEY || 'myMasterKey' //Add your master key here. Keep it secret!
});

@singh7889
Copy link
Author

#vineetbindal
You put aapId and masterKey in index.js file and open terminal and run npm start then u got

DATABASE_URI not specified, falling back to localhost.
parse-server-example running on port 1337.

then open new terminal and write
curl -X GET
-H "X-Parse-Application-Id: XXXXXXXXXXXXRyem"
-H "X-Parse-Master-Key: XXXXXXXXXXXXXBWA"
http://localhost:1337/parse/classes/Game

then u got data for Game

@vineetbindal
Copy link

@singh7889 . I understand that. The question is how do I fix "DATABASE_URI not specified, falling back to localhost." where do I specify "DATABASE_URI" so that it wont fall back to localhost and point to my remote DB.

I know where to put application-id and master-key. Its documented pretty well. But nowhere it has been mentioned that where to put DATABASE_URI.

@vineetbindal
Copy link

Aanyone knows where can i define these values :
process.env.DATABASE_URI || process.env.MONGOLAB_URI;

@drew-gross
Copy link
Contributor

You put them in databaseURI in the place where you initialize the parse-server

// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/dev',
  cloud: '/home/myApp/cloud/main.js', // Provide an absolute path
  appId: 'myAppId',
  masterKey: '', //Add your master key here. Keep it secret!
  fileKey: 'optionalFileKey',
  serverURL: 'http://localhost:' + port + '/parse' // Don't forget to change to https if needed
});

montymxb pushed a commit to montymxb/parse-server that referenced this issue Feb 14, 2016
@vineetbindal
Copy link

I have updated this info and updated node.js too and getting this
DATABASE_URI not specified, falling back to localhost.
events.js:141
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE :::1337
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1236:14)
at listen (net.js:1272:10)
at Server.listen (net.js:1368:5)
at Function.app.listen (/Users/Documents/workspaceParse/parse-server-example/node_modules/express/lib/application.js:532:24)
at Object. (/Users/Documents/workspaceParse/parse-server-example/index.js:36:5)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! parse-server-example@1.1.0 start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the parse-server-example@1.1.0 start script 'node index.js'.
npm ERR! This is most likely a problem with the parse-server-example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index.js
npm ERR! You can get their info via:
npm ERR! npm owner ls parse-server-example
npm ERR! There is likely additional logging output above.

@drew-gross
Copy link
Contributor

That error is because you already have the parse server running on that port. You can't run two servers on the same port. Shut down your existing server, or pick another port.

@anushajp
Copy link

@iulianvarzaru

I agree with your point.
I did not provide the header keys inside request. I don't know where to put these keys and where is header to include the app_id. Could you please help me on this?

@sidan5
Copy link

sidan5 commented Aug 17, 2016

Have same issue with the error but found out that it is connected to the remote DB server...

@sanjibnarzary
Copy link

sanjibnarzary commented Oct 30, 2016

To start the parse server use the following command in cmd/terminal

parse-server --appId myGreatAppId --masterKey mygreatmasterkey --databaseURI mongodb://localhost/mydb

For the one who has DATABASE_URI not found error---
This may be a late reply but you can resolve it by setting environment variable. In windows set the DATABASE_URI
C:\>set DATABASE_URI=mongodb://localhost:port/yourdb
C:\>npm start

In linux also you can set the environment variable as following

$DATABASE_URI=mongodb://localhost:port/yourdb
$export DATABASE_URI
$npm start

The same environment variables are available in app.yaml file in the root directory.

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

8 participants