googlecodelabs / tools

Codelabs management & hosting tools
Apache License 2.0
4.22k stars 1.14k forks source link

Access Denied on codelab-elements #796

Closed vladcipariu91 closed 1 year ago

vladcipariu91 commented 2 years ago

hello,

I'm generating codelabs using claat and everything worked well but as of today I've started getting

<Error>
    <Code>AccessDenied</Code>
    <Message>Access denied.</Message>
    <Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.</Details>
</Error>

when trying to access: https://storage.googleapis.com/codelab-elements/native-shim.js

can you give me some pointers please? thanks

jakubhyza commented 2 years ago

Same issue here. From this morning all my codelabs pages are suddenly not working and I'm getting the same error. I tried to import them again but nothing.

electricbaka commented 2 years ago

CSS and JavaScript are 403 errors.

GET https://storage.googleapis.com/codelab-elements/codelab-elements.css net::ERR_ABORTED 403
GET https://storage.googleapis.com/codelab-elements/prettify.js net::ERR_ABORTED 403
GET https://storage.googleapis.com/codelab-elements/custom-elements.min.js net::ERR_ABORTED 403
GET https://storage.googleapis.com/codelab-elements/native-shim.js net::ERR_ABORTED 403
GET https://storage.googleapis.com/codelab-elements/codelab-elements.js net::ERR_ABORTED 403
iamontheinet commented 2 years ago

Same. We're seeing the same errors on our site as well. Any updates/pointers will be very much appreciated. Thanks!

khammami commented 2 years ago

Here a temporary work around:

To work around this problem, in your index.html file, change occurrences of:

https://storage.googleapis.com/codelab-elements

to

https://storage.googleapis.com/codelab-elements-tmp

Note the "-tmp" suffix is the only change.

Please read the conversation with Marc on Google groups : https://groups.google.com/g/codelab-authors/c/WwSdRF4bjBE/m/tA96pyWOEAAJ

agargenta commented 2 years ago

Note, if you are able to host these assets yourselves, you can re-export your codelabs as claat export -prefix <url-to-your-assets> <codelab> to get it working again.

pmeijer-hva commented 2 years ago

Any update on this issue? I rather not apply the -tmp fix. Is there actually working someone on this solution?

khammami commented 2 years ago

if you've already uploaded the bundle you've got after building, you'll find those files under elements/codelab-elements.

You just need need to point to them instead of using https://storage.googleapis.com/

Just replace any occurence of:

https://storage.googleapis.com/codelab-elements

by

[your-domain-name]/elements/codelab-elements

in all your codelabs using an editor

or you can use claat to re-export/update your codelabs using the option --prefix

$ claat export your_file.md --prefix [your-domain-name]/elements

I hope this may help :)

beniroquai commented 2 years ago

Thanks @khammami, I'll read into this.

beniroquai commented 2 years ago

@khammami replacing the references in the files directly works, but in best case I want to do that in the first place by your -prefix-thingy . I have tried implementing it in this Github Actions, but it fails with a cryptic error. How would I update it? Any idea? Thanks a lot!

khammami commented 2 years ago

@khammami replacing the references in the files directly works, but in best case I want to do that in the first place by your -prefix-thingy . I have tried implementing it in this Github Actions, but it fails with a cryptic error. How would I update it? Any idea? Thanks a lot!

@beniroquai try to export your codelabs without -prefix then iterate over codelabs folders and update them with claat one by one

example claat update for a codelab based on your github action:

$ cd uc2-tutorial-discoverykit
uc2-tutorial-discoverykit$ claat update -prefix  "https://openuc2.github.io/elements/elements"

I tested both command locally they work for me, may be because I'm using an old version of claat that I compiled by myself.

In your github action I don't know why it ask for authorising claat app while exporting. usually it ask when you try to export a google doc.

beniroquai commented 2 years ago

Thanks @khammami for your help. I'll try that directly.

mco-gh commented 1 year ago

fixed in v2.2.5

andybeeching commented 1 year ago

Hi @mco-gh, thanks for taking the time to address this issue.

For me it's not working unfortunately. I see the patch to reference the static assets from claat-public, however for me the latest claat version still places the affected files inside elements/codelab-elements.

I was building my codelabs with claat export -prefix "/elements" "$filename" which worked fine in 2.2.4.

mco-gh commented 1 year ago

can you run claat version for me?

khammami commented 1 year ago

@andybeeching Just rename this folder to claat-public and replace any occurence of codelab-elements here to claat-public (line 131 & 211)

stefanhoth commented 1 year ago

@khammami Thank you, this worked. Worth checking what this might break in the future regarding updates but it worked for now and is easily reversible.

khammami commented 1 year ago

@stefanhoth you're welcome. you may also change it in claat and build your own custom claat or it could be a feature request for @mco-gh to add an option like -prefix for custom path