Skip to content

fix: add is_server parameter to S3Storage.__init__#9114

Open
HermessNRJ wants to merge 1 commit into
makeplane:previewfrom
HermessNRJ:fix/s3storage-is-server-param
Open

fix: add is_server parameter to S3Storage.__init__#9114
HermessNRJ wants to merge 1 commit into
makeplane:previewfrom
HermessNRJ:fix/s3storage-is-server-param

Conversation

@HermessNRJ
Copy link
Copy Markdown

@HermessNRJ HermessNRJ commented May 21, 2026

Description

asset.py calls S3Storage(request=request, is_server=True) in three places (lines 337, 441, 565), but S3Storage.init in plane/settings/storage.py only accepts request=None — the is_server parameter was never added.

This causes a TypeError: S3Storage.init() got an unexpected keyword argument 'is_server' on every request that hits those asset endpoints, resulting in HTTP 500 errors for all asset operations (upload slot creation, presigned URL generation, attachment downloads) when USE_MINIO=1.

The fix adds is_server=False to init and updates the endpoint_url condition so server-side calls use AWS_S3_ENDPOINT_URL instead of deriving the host from the HTTP request object.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

N/A

Test Scenarios

  • Reproduced the TypeError on Plane 1.3.1 with USE_MINIO=1 / RustFS or Minio storage by hitting GET /api/v1/workspaces/{slug}/assets/{id}/
  • Applied the patch to a running pod and confirmed asset upload and download endpoints return 200
  • Verified that client-side presigned URL generation (where request is provided and is_server=False) still derives the endpoint from the request host as before

References

Fixes #8680

Summary by CodeRabbit

  • Chores
    • Enhanced S3/MinIO storage configuration handling to support improved endpoint URL resolution for server-side operations, increasing flexibility in storage setup configurations.

Review Change Stack

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 21, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f616697-3339-4144-a802-3d3ecb2abb79

📥 Commits

Reviewing files that changed from the base of the PR and between 039d582 and 4a1fed3.

📒 Files selected for processing (1)
  • apps/api/plane/settings/storage.py

📝 Walkthrough

Walkthrough

The PR adds an is_server parameter to S3Storage.__init__ and updates S3 endpoint URL construction logic. When is_server is true or no request is available, the S3 client uses the configured AWS_S3_ENDPOINT_URL/MINIO_ENDPOINT_URL value instead of deriving the host and protocol from the incoming request.

Changes

S3Storage Server Parameter Support

Layer / File(s) Summary
S3Storage constructor and endpoint URL handling
apps/api/plane/settings/storage.py
S3Storage.__init__ accepts new is_server parameter; MinIO endpoint URL construction now checks is_server and falls back to configured endpoint URL when server mode is active or request is unavailable, instead of always using request.get_host()-derived URL.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through S3's domain,
With is_server now in the main,
No more request-derived confusion,
Endpoints find their true conclusion,
MinIO sings a clearer refrain! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding an is_server parameter to S3Storage.init.
Description check ✅ Passed The PR description is comprehensive, including detailed explanation of the bug, root cause, fix, and test scenarios. All required template sections are properly filled.
Linked Issues check ✅ Passed The PR directly addresses issue #8680 by adding the is_server parameter that was missing from S3Storage.init, fixing the TypeError and enabling asset endpoints.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the is_server parameter issue. No out-of-scope modifications are present beyond what is required.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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]: GET /api/v1/workspaces/<slug>/assets/<asset_id>/ returns 500 - S3Storage.__init__() does not accept is_server parameter

2 participants