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

Can't download a file that doesn't exist on the server or locally #206

Closed
mogsten opened this issue Feb 3, 2016 · 12 comments
Closed

Can't download a file that doesn't exist on the server or locally #206

mogsten opened this issue Feb 3, 2016 · 12 comments
Labels
type:question Support or code-level question

Comments

@mogsten
Copy link

mogsten commented Feb 3, 2016

I keep getting this error

Can't download a file that doesn't exist on the server or locally. (Code: 151, Version: 1.12.0)

I have included the fileKey in the index.js file but can't seem to get access to any image or video based content. Only text based content works properly

@gfosco
Copy link
Contributor

gfosco commented Feb 4, 2016

Can you log the contents of the file object? What does the url key look like?

@mogsten
Copy link
Author

mogsten commented Feb 5, 2016

How would I do that?
I am trying to get a PFFile from the MongoDB Database connected to a Parse Server instance hosted on Heroku
Is there something that may be causing it not to work?

@chriscborg
Copy link
Contributor

This happened to me as well when trying to save a PFUser. During this save operation, no file was being uploaded however the user's document did have a link to an image saved on S3. I had to delete the schema and collection and re-create the users for it to start working.

@gfosco
Copy link
Contributor

gfosco commented Feb 6, 2016

Does your filename have an extension?

@mogsten
Copy link
Author

mogsten commented Feb 6, 2016

All of my files are .png files, I can't download them from Parse with the Parse Server hosted on Heroku and the Database Hosted with MongoDB

@gfosco
Copy link
Contributor

gfosco commented Feb 8, 2016

In trying to find out why this is happening, it would be great if you could log or capture a request against your parse-server which returns the file object.

You can run the server with the environment variable VERBOSE=1, query for the object with the file column, and then check the heroku logs. Can you do this?

@topwebtek7
Copy link

I am working on migration parse.

So I could migrate Parse DB to MongoDB using MongoLab.
Also I could change parse-server-example;

add cloud code(for mandrill-api and twilio) in main.js.(this works very well)
deploy to Heroku.
However, I have some issues here.

On iOS development side, when the user logs in, app don't progress any PFObject.

if I am going to change user's profile(string, boolean, image and so on), I get error message
[Error]: Can't upload a file that doesn't exist locally. (Code: 151, Version: 1.12.0)

If I am going to download the user's photo, I get error message.
[Error]: Can't download a file that doesn't exist on the server or locally. (Code: 151, Version: 1.12.0)

Also I found a strange issue.
After migration, I created a new account on my app.(without user's photo)
First, it seems it works very well

But If I upload user's photo, connection error occurs.

What's matter?

I hope you can help me.

Thanks

@topwebtek7
Copy link

@vioside

Thanks for sharing how to fix your issue.

I got same error message if I save PFUser.currentUser.

However, I am working on migration parse app on app store.

So the number of users is over 300. I am afraid that I can lost data.

@tdunham02
Copy link

My solution:

Save the PFFile as usual, but when saving it to Heroku (MongoLabs), save the file's URL to an NSString field. From there, load the image from the URL with AFNetworking...

PFFile *image = [PFFile fileWithData:imageData];
[image saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (!error) {         
        //Set user data
        user[@"picture"] = image;
        user[@"pictureLink"] = image.url;
        [user saveInBackground];
    }
}];

Load:

if (user[@"pictureLink"]) {
    [imageView setImageWithURL:[NSURL URLWithString:user[@"pictureLink"]] placeholderImage:nil];
}

Not sure if this is the best way, but it works!

@mogsten
Copy link
Author

mogsten commented Feb 14, 2016

Cheers tdunham02. It works perfectly for me, but it is a little bit slow, might have something to do with where the Parse Server is hosted

@mogsten
Copy link
Author

mogsten commented Feb 15, 2016

I have updated the Parse Server module on my Digital Ocean box and I am still getting the same error. Is there any official documentation that shows us how to completely setup Parse Server from scratch on any hosting provider?

@gfosco
Copy link
Contributor

gfosco commented Feb 20, 2016

There's this, and they have an expanded part 2 coming out soon: https://www.digitalocean.com/community/tutorials/how-to-run-parse-server-on-ubuntu-14-04

If you're still having issues with the latest version, please try to get a clear reproduction steps list and capture any messages. Try to identify exactly which step is going wrong. When you have that, please open a new issue. Thanks. 👍

@gfosco gfosco closed this as completed Feb 20, 2016
@mtrezza mtrezza added type:question Support or code-level question and removed 🔧 troubleshooting labels Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

6 participants