Skip to content

Conversation

@neoformalex
Copy link
Contributor

Google Cloud PHP package depricates DEFAULT_API_ENDPOINT and uses bucket name from the configuration.

@neoformalex
Copy link
Contributor Author

Poke @freekmurze 🙂

@freekmurze freekmurze merged commit 180081a into spatie:main Mar 5, 2025
@freekmurze
Copy link
Member

Thanks!

@jon-sm
Copy link

jon-sm commented Mar 5, 2025

Hello!

This release is changing URL generation under the same configuration. We use a cloudflare DNS subdomain proxy pointing to the GCS bucket URL.

GOOGLE_CLOUD_STORAGE_API_URI=https://files.domain.com -> pointed to https://storage.googleapis.com/bucket-name/

In this scenario now all URLs are 404s since they are pointing to https://storage.googleapis.com/bucket-name/bucket-name/foo.

I am lacking context for the purpose of the change but I can't seem to replicate previous behaviour without changing our DNS record. Do you have any insight?

Thank you!

@BertvanHoekelen
Copy link

This shouldn't have been in a minor release as the default endpoint got changed and the "https://storage.googleapis.com/" from all url's went missing without setting up the GOOGLE_CLOUD_STORAGE_API_URI env variable.

For other people running into this issue:
Just add GOOGLE_CLOUD_STORAGE_API_URI=https://storage.googleapis.com/ to your environment variables.

{
$storageApiUri = rtrim(Rest::DEFAULT_API_ENDPOINT, '/').'/'.ltrim(Arr::get($this->config, 'bucket'), '/');
// Get the storage API URI from the configuration trim the trailing slash
$storageApiUri = rtrim(Arr::get($this->config, 'storageApiUri'), '/');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes conflict when there is no storageApiUri configured, in this case we used the default_api_endpoint, this $storageApiUri = rtrim(Arr::get($this->config, 'storageApiUri'), '/'); should be optional if there is some storageApiUri configured if not you should use the default $storageApiUri = rtrim(Rest::DEFAULT_API_ENDPOINT, '/').'/'.ltrim(Arr::get($this->config, 'bucket'), '/'); in order to no break legacy implementations.

@freekmurze
Copy link
Member

I've reverted this PR in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants