mongodbdigital-oceanparse-serverparse-dashboard

Parse Server - Can't Access Images


I have a Parse Server running on top of a MongoDB, and that's running 100% fine on my Dev Server which is hosted on DigitalOcean. Here I'm able to send GET requests to my server to obtain the image, as well as access the image via it's Parse-Dashboard.

I cloned that droplet to set up a Production Server, and everything is running fine... Except, I can't access the images from Parse that were either cloned from the Dev Server, or ones that I uploaded after I initialized the new Production server. I'm able to send GET requests to obtain all other fields, except for the image files. I also can't access the image file via the Parse-Dashboard - it returns a 404 - Oh no, we can't find that page! error, on the following URL: http://server.ip/parse/files/ProdServer/de632aeb61f7265926e554fabfb25180_image1.png

Other key things to note:

  1. The Dev Server is hosted on a domain that has a SSL; could it be an SSL issue?
  2. I'm initializing the parse-dashboard with the --allowInsecureHTTP flag
  3. Everything (even before the SSL) was working on the Dev Server beforehand
  4. all packages + dependencies are up-to-date

tl;dr

How do I access the image files from my Parse Server, via Parse-Dashboard or GET request?


Solution

  • A couple methods I tried... Since this was an elaborate process for me, allow me to document the methods I tried to resolve this issue:

    The first issue was, do the files exist? If so, where are they stored?

    By accessing my parse-dashboard on port 4040, I tried to view the image path via the URL... So I knew it existed somewhere, and I recursively searched my entire server for the file path, but to no avail.

    Then with more research I found that any file over 16MB gets converted into a GridFS object i.e. images are stored in my MongoDB. How you access these objects are through a utility called mongofiles.

    By running mongofiles -d dbname list I was able to view in a list view all of the images stored on my Parse-Server.

    just to ensure the images weren't corrupt...

    I also sftp the images over into my local machine, and fortunately I could view them. So the problem was that the images weren't being served correctly...

    The next issue was, how come the images aren't being served correctly?

    So my parse-dashboard was being served on port 4040, but for some reason, my image file path within their respective URLs were being prefaced with the same port 4040... It turns out that within my Parse-Server config, the parse-server URL was pointing to port 4040, but was being served on ****. By changing my URL back to ****, my images were able to properly render on my parse-dashboard, and I was able to send http requests for the images as well :)


    tl;dr make sure your image file path is being served on the same port where your parse-server is being served