Link to 
SO: 
https://stackoverflow.com/questions/45539115/use-google-cloud-storage-on-local-environment-with-php-standard-env

up vote
down votefavorite 
<https://stackoverflow.com/questions/45539115/use-google-cloud-storage-on-local-environment-with-php-standard-env#>

I am running PHP Standard Env on Google App Engine. I am trying to get 
files from my production storage in my local environment.

Here is what my code looks like:

$json = 
json_decode(file_get_contents("gs://$bucket/$email_id/envelope.json"), 
true);

It works great in production, however in development I am getting this 
error:

Warning: file_get_contents(gs://sendgrid-inbound/12/envelope.json): failed 
to open stream: 
"\google\appengine\ext\cloud_storage_streams\CloudStorageStreamWrapper::stream_open"
 
call failed in /Users/thom/Engine/site-com/main.php on line 10

I tried downloading GCS API tools composer require google/cloud

require __DIR__ . '/vendor/autoload.php';use Google\Cloud\Storage\StorageClient;
echo  __DIR__ .'/appdocs-com.json';
$storage = new StorageClient([
   'keyFilePath' => __DIR__ .'/site-com.json',]);

$storage->registerStreamWrapper();

This method works great for Flex Env, however in Standard this returns the 
same error as before.

I have seen comments about setting up an Emulator, but I have found nothing 
on how to do this. If anyone has a working example of how to do this, I 
would really like to see how it is done.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/cbde1799-279d-4750-9388-ec62fd15d58b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine... Thomas Valadez
    • [google-appe... 'George (Cloud Platform Support)' via Google App Engine
      • [google-... Thomas Valadez
        • [goo... 'George (Cloud Platform Support)' via Google App Engine
          • ... Thomas Valadez
            • ... 'George (Cloud Platform Support)' via Google App Engine
              • ... Thomas Valadez
                • ... 'Yannick (Cloud Platform Support)' via Google App Engine
                • ... Thomas Valadez
                • ... Thomas Valadez
                • ... 'Yannick (Cloud Platform Support)' via Google App Engine

Reply via email to