Skip to content

fix(storage-gcs): return error status 404 on file not found instead of 500 #11746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025

Conversation

akhrarovsaid
Copy link
Contributor

What?

In a similar vein to #11734, #11733, #10327 - this PR returns a 404 in the response when a file is not found while using the storage-gcs adapter. Currently a 500 is returned.

Why?

To return the correct error level in the response when a file is not found when using storage-gcs.

How?

The GCS nodejs library exposes the ApiError as a general error - these changes check that the caught error is an instance of this class and if the provided code is a 404.

@akhrarovsaid akhrarovsaid changed the title fix(storage-gcs): return 404 on file not found fix(storage-gcs): return 404 on file not found instead of 500 Jun 10, 2025
@paulpopus paulpopus changed the title fix(storage-gcs): return 404 on file not found instead of 500 fix(storage-gcs): return error status 404 on file not found instead of 500 Jun 11, 2025
@paulpopus paulpopus merged commit d8626ad into payloadcms:main Jun 11, 2025
79 checks passed
@akhrarovsaid akhrarovsaid deleted the fix/gcs-return-404 branch June 11, 2025 14:08
Copy link
Contributor

🚀 This is included in version v3.43.0

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

Successfully merging this pull request may close these issues.

2 participants