MarkEdmondson1234 / googleCloudRunner

Easy R scripts on Google Cloud Platform via Cloud Run, Cloud Build and Cloud Scheduler
https://code.markedmondson.me/googleCloudRunner/
Other
82 stars 26 forks source link

http_403 error for test #5 #190

Open eteitelbaum opened 2 years ago

eteitelbaum commented 2 years ago

Hi Mark,

When I run test number 5 (Cloud Scheduler -- R script), I get an http_403 error (user not authorized to perform this action). Any idea what might be causing this? I am running the development version, which I just installed now.

Here is the exact text for the test and error message:

-- Testing scheduling R script deployments via cr_deploy_r(schedule = ' *') --

i 2022-03-30 08:30:56 > Deploy R script cr_rscript_2022031648643456083056 to Cloud Build i 2022-03-30 08:30:56 > Scheduling R script on cron schedule: * i 2022-03-30 08:30:56 > Creating PubSub topic: cr_rscript_2022031648643456083056-topic √ projects/recession-charts/topics/cr_rscript_2022031648643456083056-topic succesfully created i 2022-03-30 08:31:01 > Request Status Code: 403 Error: http_403 User not authorized to perform this action.

Thanks for your help!

MarkEdmondson1234 commented 2 years ago

Thanks - would you mind reporting what IAM roles the service account you created in setup has in the web console? By default called googlecloudrunner@{project-id}.iam.gserviceaccount.com

Should see it on this URL: https://console.cloud.google.com/iam-admin/iam

Is it different from this?

image
eteitelbaum commented 2 years ago

Yes, it is different. I only see a subset of those roles:

iam-roles

Did I miss a step during the setup or something?

MarkEdmondson1234 commented 2 years ago

Its probably my fault with the permissions code. Would you mind running the test to fail again, with options(googleAuthR.verbose=2) to give more logging info? That can narrow down which service is missing. As it stands now I suspect maybe its the general Viewer role that is necessary for viewing logs.

eteitelbaum commented 2 years ago

OK, sure. Here is what I see when I run it that way:

-- Testing scheduling R script deployments via cr_deploy_r(schedule = ' *') --

i 2022-03-30 11:14:53 > Deploy R script cr_rscript_2022031648653293111453 to Cloud Build i 2022-03-30 11:14:53 > Scheduling R script on cron schedule: * i 2022-03-30 11:14:53 > Creating PubSub topic: cr_rscript_2022031648653293111453-topic i 2022-03-30 11:14:53 > Token exists. i 2022-03-30 11:14:53 > Request: https://pubsub.googleapis.com/v1/projects/recession-charts/topics/cr_rscript_2022031648653293111453-topic/ i 2022-03-30 11:14:53 > Body JSON parsed to: {} √ projects/recession-charts/topics/cr_rscript_2022031648653293111453-topic succesfully created i 2022-03-30 11:14:57 > data json: "projects/recession-charts/topics/cr_rscript_2022031648653293111453-topic" i 2022-03-30 11:14:57 > data encoded to: InByb2plY3RzL3JlY2Vzc2lvbi1jaGFydHMvdG9waWNzL2NyX3JzY3JpcHRfMjAyMjAzMTY0ODY1MzI5MzExMTQ1My10b3BpYyI= i 2022-03-30 11:14:57 > Token exists. i 2022-03-30 11:14:57 > Request: https://pubsub.googleapis.com/v1/projects/recession-charts/topics/cr_rscript_2022031648653293111453-topic/ i 2022-03-30 11:14:57 > Request Status Code: 403 i 2022-03-30 11:14:57 > API error: User not authorized to perform this action. i 2022-03-30 11:14:57 > No retry attempted: User not authorized to perform this action. i 2022-03-30 11:14:57 > Custom error 403 User not authorized to perform this action. Error in abort_http(): ! http_403 User not authorized to perform this action.

Does that help?