0

I'm using the dev_appserver.py to test out my application (it's still far from being ready to deploy). My application allows users to upload files which is working fine. However, when I go to serve those files, I'm running into problems.

I'm serving them through my application rather than using the public URL because I need to restrict access to only authorized users. When I attempt to serve the file using CloudStorageTools::serve, I get a 500 error. I've tried catching the error and have been unable to do so (I still get a 500 error even though it's wrapped in a try-catch block). The only indication I have as to what's going wrong is from the logs:

ERROR    2018-02-17 17:06:54,105 blob_download.py:202] Blob-serving response with status 404, expected 200.

Based on that it looks like it can't find the file but I can't figure out why. I can access the file just fine using file_get_contents so I know it got uploaded correctly.

What's going wrong? Why is CloudStorageTools unable to find the file?

Victor M Perez
  • 2,185
  • 3
  • 19
  • 22
cjc
  • 731
  • 3
  • 13
  • Are you using App Engine Standard or Flexible? – Victor M Perez Feb 27 '18 at 09:26
  • Hi @cjc, have you followed these steps carefully: https://cloud.google.com/appengine/docs/standard/php/googlestorage/user_upload? Let's review the process. Please answer so I can look into it – Victor M Perez Feb 28 '18 at 15:59
  • 1
    I'm using the standard environment and I have set it up the way that specifies. This is only happening in the dev server. When I deployed it for testing on the "production" server it worked just fine. – cjc Mar 01 '18 at 16:36
  • I'm not able to reproduce your error. Can you provide a sample piece of code that can reproduce this 500 error? If you're stuck running your code, we have 10 samples on GitHub that use `dev_appserver`: https://github.com/GoogleCloudPlatform/php-docs-samples – Grant Timmerman Jun 11 '19 at 03:12
  • At this point it's been long enough that I don't remember exactly how I solved it. Based on what I can see in my source control history it was likely trying to connect to the cloud datastore and not my local dev machine datastore (which is way too easy to do). There may have also been a bug with the filepath that for some reason didn't cause problems when actually deployed. – cjc Jun 18 '19 at 20:11

0 Answers0