Skip to content

Conversation

@possebon
Copy link

@possebon possebon commented Oct 3, 2025

  • Add UsePathStyle option to S3 client configuration
  • Required for S3-compatible services like Backblaze B2
  • Restores functionality lost in AWS SDK v1 to v2 migration
  • Compatible with Amazon S3, Backblaze, and arm64 architecture

Fixes #140

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with S3-compatible storage by switching to path-style addressing, reducing access and listing errors with certain buckets, regions, and VPC/private endpoints.
    • Enhances reliability when connecting to providers like MinIO or Ceph and legacy S3 setups.
    • No action required; existing configurations continue to work with more consistent connectivity and fewer endpoint-related issues.

- Add UsePathStyle option to S3 client configuration
- Required for S3-compatible services like Backblaze B2
- Restores functionality lost in AWS SDK v1 to v2 migration
- Compatible with Amazon S3, Backblaze, and arm64 architecture

Fixes eduardolat#140

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Oct 3, 2025

Walkthrough

Updated S3 client initialization to enable path-style addressing by adding an option to s3.NewFromConfig. No other logic, error handling, or control flow changes.

Changes

Cohort / File(s) Summary
S3 client configuration
internal/integration/storage/s3.go
Set UsePathStyle = true in createS3Client by passing an options function to s3.NewFromConfig.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I twitch my whiskers, clouds roll by,
A path-style hop to S3’s sky.
No loops to chase, no flows to mend,
Just straighter trails to bucket’s end.
Thump-thump—uploads hum, I cheer: “Whee!”
Ears up high—it’s smooth for B2 and S3. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title clearly and concisely describes the key change of enabling path-style addressing to fix S3 and Backblaze upload failures, matching the primary modification in the code without extraneous detail or noise.
Linked Issues Check ✅ Passed The addition of the UsePathStyle option directly addresses the S3 and Backblaze upload failures described in issue #140 by restoring path-style addressing compatibility for AWS SDK v2 without altering other functionality, meeting the linked issue requirements.
Out of Scope Changes Check ✅ Passed The only change in the pull request is the targeted configuration update to enable path-style addressing for the S3 client, and there are no unrelated or extraneous modifications outside the scope of issue #140’s objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
internal/integration/storage/s3.go (1)

46-50: LGTM! Fix addresses the reported S3 upload failure.

The change correctly enables path-style addressing, which is required for S3-compatible services like Backblaze B2. This restores functionality lost in the AWS SDK v1 to v2 migration, as v2 defaults to virtual-hosted-style addressing while v1 used path-style by default. AWS S3 supports both addressing styles, so this change maintains compatibility with standard S3 while fixing Backblaze uploads.

Consider making path-style addressing configurable.

While hardcoding UsePathStyle = true fixes the immediate issue and works with both AWS S3 and Backblaze, consider adding a configuration option for future flexibility. Some users might prefer virtual-hosted-style for AWS S3 (e.g., for CloudFront compatibility or to match bucket policies), while others need path-style for S3-compatible services.

Example approach:

func createS3Client(
	accessKey, secretKey, region, endpoint string,
	usePathStyle bool,
) (*s3.Client, error) {
	// ... existing code ...
	
	s3Client := s3.NewFromConfig(conf, func(o *s3.Options) {
		o.UsePathStyle = usePathStyle
	})
	return s3Client, nil
}

This would require updating all callers and adding a configuration field, but provides better flexibility for diverse S3-compatible services.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cafda5 and 310733a.

📒 Files selected for processing (1)
  • internal/integration/storage/s3.go (1 hunks)

@pierre-b
Copy link

pierre-b commented Oct 9, 2025

Hi, my issue #145 seems to be related to this PR. Thanks for merging.

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.

[bug] Upload to Amazon S3 and Backblaze fails on v0.5.0 and v0.4.2 (works only on v0.4.0)

3 participants