parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.91k stars 4.78k forks source link

Error displaying images from Parse-Server (Heroku/Mongolab) #170

Closed calhouncole closed 8 years ago

calhouncole commented 8 years ago

In my Parse database, I have several images that are called and displayed by an iOS Client. When the client is connected to the parse apis, these images display no problem. However, when connected to my own parse-server, the images don't show and the following error is logged:

[Error]: Response status code was unacceptable: 403 (Code: 1, Version: 1.12.0)
Error Domain=Parse Code=1 "Response status code was unacceptable: 403" UserInfo={error=Response status code was unacceptable: 403, NSLocalizedDescription=Response status code was unacceptable: 403, code=1}

All other queries work just fine. I'm using the heroku/mongolab stack described in the migration tutorial. I've also successfully migrated my database from Parse to mongolab.

Are there any settings that need to be changed in the Parse-Server or in mongolab? Thanks in advance!

reinder42 commented 8 years ago

@calhouncole Did you set the fileKey in the configuration dictionary in when initializing the ParseServer instance? In parse-server-example, this happens in index.js. You can find the key in your Parse Dashboard.

calhouncole commented 8 years ago

@reinderdevries Thanks for the tip. Seems to have worked.

Do you know if the files themselves are stored on the mongodb or does Parse store a link to the actual file in a S3?

In the migration guide, it states the following: "fileKey: A key that specifies a prefix used for file storage. (only necessary for old files in s3 clarify this)"

If Parse is storing these files in an S3, I'm assuming I won't be able to access them after Parse's hosting service has been discontinued?

skinp commented 8 years ago

@calhouncole hold files that already existed before the migration are still stored in S3. We're working on a migration tool to allow you to download those to somewhere you control.

As for new files by default they're stored in Mongo (GridStoreAdapter) but you can also setup S3 using the new S3Adapter.

sanergulec commented 8 years ago

Hi Calhouncole,

I have the same problem about displaying images in my IOS swift project. I migrated from parse to mongolab and AWS beanstalk. How can I add the fileKey? I am a bit new in coding, I tried to add the fileKey in the AWS console as in the picture below, but it didn't work. Should I also add it to the appDelegate in my ios project? Or did I added the fileKey in the AWS console wrong?

pgwyh

calhouncole commented 8 years ago

@sanergulec -- sorry for the late response.

You need to add the fileKey to your parse-server initialization. I'm running on Heroku/mongolab and mine is as so:


var parse_api = new ParseServer({
  databaseURI: process.env.MONGOLAB_URI || 'xxxxxxx',
  cloud: './cloud/main.js',
  appId: 'xxxxxxx',
  fileKey: 'xxxxxxx',
  masterKey: 'xxxxxxx',
  serverURL: process.env.PARSE_SERVER_URL || 'http://www.xxxxx.com/parse'
});

app.use('/parse', parse_api);
KathleenFMalone commented 8 years ago

Hi. I am having the same problem with images, but I'm using objective-c. The configuration class is ParseMutableClientConfiguration and there is not a fileKey property on that class. Where can I declare the fileKey property. Or how can I get images to load on AWS beanstalk and mlab migration with client written in objective-c. Thanks!

KathleenFMalone commented 8 years ago

Sorry I misunderstood the thread above. I thought you needed to add the fileKey on the client side, but it looks like it needs to be added on the new parse server installation. I'm using AWS beanstalk like @sanergulec and there is not an option to add it there. Do you know where I do this in beanstalk? I have the same console as @sanergulec, but it looks like adding where he/she tried doesn't work.

reinder42 commented 8 years ago

You're right, try setting it in your index.js / wherever you create the ParseServer instance, just like @calhouncole mentioned. Don't forget to add, commit and deploy your code changes.

KathleenFMalone commented 8 years ago

Ok, I'll look into it some more. With beanstalk, I never had to do anything with index.js. I just hit install, added app_id, database_url and master_key and everything was set up. I'll post if/when I figure it out. Thanks.

ratan93 commented 8 years ago

Hello Everyone,

@KathleenFMalone, were you able to solve the concern of image loading with error : [Error]: Response status code was unacceptable: 403 (Code: 1, Version: 1.14.2)

Currently I am going through this issue as recently I migrated my iOS Application from Parse Server to back4app server and getting the above error with each file download, not able to get the data. So please help me on this if you were solve the concern and guide me.

Thanks, Ratneshwar Singh, iOS App Developer

jakelisby commented 7 years ago

@ratan93 make sure your file key matches what was on Parse.com (you can update back4app if needed). This will allow you to see previous files and continue supporting both connections in the future.

wellkeptbeauty commented 7 years ago

Hello Everyone,

@KathleenFMalone, were you able to solve the concern of image loading with error : [Error]: Response status code was unacceptable: 403 (Code: 1, Version: 1.14.2)

Currently I am going through this issue as recently I migrated my iOS Application from Parse Server to Heroku server and getting the above error with each file download, not able to get the data. So please help me on this if you were solve the concern and guide me.

Thanks, karthik

mital87 commented 7 years ago

Hello Team,

I have migrated my iOS Application from Parse Server to Heroku server and getting the error with each file download, not able to get the data. Please help me to resolve this issue as soon as possible. Do needful.

Thanking You.

Best Regards, Mital