parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse JSON error

Open midgyb opened this issue 10 years ago • 5 comments

For implementation related questions or technical support, please refer to the stackoverflow community.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

iOS 9.2 -- Parse SDK - Latest Release (v1.12.0)

Steps to reproduce

Upon launch I get the error: Failed to run command eventually with error... User interaction is not disabled but attempting to sign up or log in a user will not work and no error is printed to the console. I am not attempting to fetch any JSON at the time of the error.

Logs/Trace

[Error]: Failed to run command eventually with error: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

midgyb avatar Mar 18 '16 08:03 midgyb

Can you post how you're initializing Parse and whether you've got the mount path set correctly (/parse) ? Also it would be helpful to run the server with the environment variable VERBOSE=1 and check the logs to see what request/responses were made.

gfosco avatar Mar 18 '16 08:03 gfosco

99% of the time, this means you've configured something wrong. The server always responds with JSON, the client always expects JSON. So, go through the steps again and make sure you're actually hitting the server.

gfosco avatar Mar 18 '16 17:03 gfosco

Thanks for the quick response. The interesting thing is I only get this error after updating main.js to my custom code and index.js to my credentials. The Parse Server works perfectly before I do this. Would it make since that the issue could be from how I've set up my values in index.js?

midgyb avatar Mar 18 '16 17:03 midgyb

You'll need to provide your code.. when you say 'credentials', what exactly are you setting?

gfosco avatar Mar 18 '16 18:03 gfosco

Sorry, I am not sure how to format this correctly, I am new to using Github but what I mean is that once I set my credentials in index.js and push it using Heroku Git and then run the app there error occurs.

`var express = require('express'); var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); }

var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://heroku_26tkwtr7:[email protected]:15909/heroku_26tkwtr7', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || 'xxxxxxxxxxxxxxxxxxxxxxxxxxx', masterKey: process.env.MASTER_KEY || 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || 'https://xxxxxxxx.herokuapp.com/parse' // Don't forget to change to https if needed }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: // javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes app.get('/', function(req, res) { res.status(200).send('I dream of being a web site.'); });

var port = process.env.PORT || 1337; app.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); }); `

midgyb avatar Mar 18 '16 18:03 midgyb