Giter Club home page Giter Club logo

Comments (9)

yash30201 avatar yash30201 commented on August 9, 2024

Hi @lope7 ,

This means you're missing the serviceusage.service.use IAM permission on your credential. Can you please post a reproduction script where I can try to confirm this issue?

from google-cloud-php.

lope7 avatar lope7 commented on August 9, 2024

Hi @yash30201,
Thank you very much for your response.
We know that it asks for that permission and we don't have it, but we want to know the reason why that permission is requested to do an "exists()" when it should not be necessary since we have been able to do other writing methods and it does not ask for this permission.
I understand that the solution is to activate that permission, but this doesn't make sense, right?

from google-cloud-php.

yash30201 avatar yash30201 commented on August 9, 2024

Yes this seems strange. That's why I wanted you to post a script where you're experiencing to troubleshoot this further.

from google-cloud-php.

lope7 avatar lope7 commented on August 9, 2024

`<?php

use Google\Cloud\Storage\StorageClient;

$storageClient = new StorageClient([
"projectId" => 'xxx',
"apiEndpoint" => 'xxx'
]);
$nameImage = 'image.jpg';
$bucket = $storageClient->bucket($this->bucketName, true);
$object = $bucket->object($nameImage);
try {
$object->exists();
} catch (Throwable $e) {
die("Our problem is here " . $e->getMessage());
}`

from google-cloud-php.

yash30201 avatar yash30201 commented on August 9, 2024

Can you tell me how do you authenticate in the library? (Service Account, gcloud auth login, Impersonated Service Account, External Account Credentials . . . )

from google-cloud-php.

glesende avatar glesende commented on August 9, 2024

Hi @yash30201 , I'm Lope's teammate. He is on vacaction. We use Service Account to authenticate.

from google-cloud-php.

yash30201 avatar yash30201 commented on August 9, 2024

Hey @glesende , I ran the following script which you provided with a Service Account which only has the Storage Admin permission. I didn't face any issue.

<?php

use Google\Cloud\Storage\StorageClient;

require_once __DIR__ . '/../vendor/autoload.php';

$storage = new StorageClient([
    'projectId' => getenv('GOOGLE_PROJECT_ID'),
    'keyFilePath' => getenv('GOOGLE_CLOUD_STORAGE_SA')
]);

$bucket = $storage->bucket('testing-bucket');
$object = $bucket->object('test.image');
try {
    $object->exists();
} catch (Throwable $e) {
    die("Our problem is here " . $e->getMessage());
}

So this rules out the fact that $object->exists() requires an extra IAM permission.

I think the issue is that your service account which the library is picking doesn't has the proper permissions to access the project which you're trying to bill the api calls.

from google-cloud-php.

glesende avatar glesende commented on August 9, 2024

Than you, we will check this with our SRE team.

from google-cloud-php.

yash30201 avatar yash30201 commented on August 9, 2024

Hey @glesende , thanks for opening this issue.

I'm closing this for now. Please reopen if it still persists and you're sure it's coming from this library.

from google-cloud-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.