Skip to content
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

Fix: Aws::S3::Errors::InvalidRequest (MAYBE-RAILS-CT) #1660

Closed
wants to merge 1 commit into from

Conversation

revise-dev[bot]
Copy link

@revise-dev revise-dev bot commented Jan 23, 2025

The error "Aws::S3::Errors::InvalidRequest: You can only specify one checksum at a time" occurs because the Cloudflare R2 storage configuration is attempting to specify multiple checksum validations simultaneously. While Cloudflare R2 uses the S3 API, it has slightly different requirements for checksums.

The original configuration had two checksum-related settings:

request_checksum_calculation: "when_required"
response_checksum_validation: "when_required"

These settings were likely intended to ensure data integrity during file uploads and downloads. However, they conflict with each other when making requests to the S3-compatible API, as only one checksum validation can be active at a time.

The fix is to simplify the checksum configuration by:

  1. Removing both existing checksum settings
  2. Adding a single checksum: nil setting to explicitly disable checksums

This change maintains compatibility with Cloudflare R2 while preventing the multiple checksum error. The nil value tells Active Storage not to include any checksum in the request, which is a valid configuration for S3-compatible storage services.

Testing this change is important since it affects file upload functionality. The existing test suite indicates that file attachments are used throughout the application, particularly for user profile images. The tests verify that files can be uploaded and stored correctly without checksum errors.

Tip

You can make revisions or ask questions of Revise.dev by using /revise in any comment or review!

  • /revise Add a comment above the method to explain why we're making this change.
  • /revise Why did you choose to make this change specifically?

Important

If something doesn't look right, click to retry this interaction.

@zachgoll
Copy link
Collaborator

Fixed via 0476f25

@zachgoll zachgoll closed this Jan 24, 2025
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.

1 participant