I have been trying for about 6 weeks to find out how to fix my problem with Parse Server and my legacy PFFiles. I am not looking to migrate the legacy PFFiles, just to use them in testing and development while Parse maintains them. After the testing, I will install an S3 file adapter.
My app, running IOS 9.3, is written in Objective C and stores images and video and runs fine while connected to the Parse.com site. I wanted to test it with the Parse Server and incrementally correct problems as I completed its migration. However, I have not been able to correct a (seemingly simple) failure that occurs with the message {"code":1,"message":"Internal server error."}.
My MongoDb is with mLab and I have appropriately included its URI (and login) and the filekey from parse as required. I have the information in my app.config file, in the environment of my parse server instance on AWS, and in the appropriate references to the environment data via my index.js file.
If I query a collection that does not have PFFile items, then the query is successful (i.e. normal). However, if I query a collection that has PFFiles then the query fails with {"code":1,"message":"Internal server error."}. I cannot retrieve even 1 record of such a failed query even in I used SelectKey in attempt to bypass the PFFile objects.
The query is:
PFQuery query = [PFQuery queryWithClassName:CLASSNAME];
query.cachePolicy = kPFCachePolicyNetworkOnly;
[query whereKey:USERNAME equalTo:[[PFUser currentUser]username]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
if (!error)
{
...
}
else NSLog(@" %@", error);
}];
In my testing I would like to be able to retrieve the legacy files and test the app with such legacy data, that supposedly is easily available (according to Parse.com).
In my index.js I have included my Parse fileKey:
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
filekey: process.env.FILE_KEY || 'no file key',
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
}
});
I have set the environmental key FILE_KEY to in for the nodeS instance on EC2.
Also, although it is redundant, I have included a FILE_KEY parameter in the app.config file (of the parse-server-example).
option_settings:
aws:elasticbeanstalk:application:environment:
PARSE_MOUNT: "/parse"
APP_ID: "ReplaceWithAppID"
MASTER_KEY: "ReplaceWithMasterKey"
DATABASE_URI: "ReplaceWithDatabaseURI"
NODE_ENV: "production"
SERVER_URL: "http://myappname.elasticbeanstalk.com/parse"
FILE_KEY: "Parse Filekey"
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
I have research previous posts and forums, and have taken a look at the Parse IOS SDK source code.
I realize that the fileKey is a prefix for the PFFILE stored on S3 by Parse, and is likely the bucket name.
Since no one seems to have my problem, it must be a result of major oversight on my part.
However, can someone help?
Your problem might have solved by now, but your file key variable in parse server initialisation seems in lower case which is incorrect. It should be fileKey
instead of filekey.