Skip to content

fix: resolve S3 BadDigest error on large file uploads - #42209

Open
abhijeetnardele24-hash wants to merge 5 commits into
appsmithorg:releasefrom
abhijeetnardele24-hash:fix/s3-multipart-baddigest
Open

fix: resolve S3 BadDigest error on large file uploads#42209
abhijeetnardele24-hash wants to merge 5 commits into
appsmithorg:releasefrom
abhijeetnardele24-hash:fix/s3-multipart-baddigest

Conversation

@abhijeetnardele24-hash

@abhijeetnardele24-hash abhijeetnardele24-hash commented Sep 8, 2026

Copy link
Copy Markdown

Description

Fixes #41971

  • Problem: When users upload large files (e.g. >16MB) through the S3 plugin, it automatically transitions into a Multipart Upload via the AWS Java SDK TransferManager. However, since Content-MD5 was explicitly being calculated and set in the overall ObjectMetadata for Object Lock compliance, the AWS S3 server rejected the multipart upload with a BadDigest error. This is because AWS expects an ETag checksum built from part hashes for multipart uploads, not the MD5 hash of the entire file.
  • Solution: Updated uploadFileInS3 in AmazonS3Plugin.java to dynamically check transferManager.getConfiguration().getMultipartUploadThreshold() and only compute and set the Content-MD5 header if the payload.length is strictly smaller than the multipart threshold. This ensures Object Lock compliance is maintained for small standard uploads, while safely unblocking large file multipart uploads.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Verified logic against TransferManager multipart initialization defaults.
  • AWS Java SDK seamlessly handles multipart upload hashing automatically when standard overall Content-MD5 is not forced.

Summary by CodeRabbit

  • Bug Fixes
    • Improved OAuth2 data source configuration handling, including sensible defaults for missing authentication details and grant types.
    • The expiration field now appears only for OAuth2 Authorization Code flows.
    • Resetting the phone input now reliably clears its text.
    • Improved Amazon S3 uploads by avoiding unnecessary checksum processing for large files.
    • Messages with a missing content type now default to text, ensuring their content is displayed correctly.

Copilot AI lite review requested due to automatic review settings September 8, 2026 06:48
@abhijeetnardele24-hash
abhijeetnardele24-hash requested a review from a team as a code owner September 8, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added awaiting-maintainer The next action on this pull request belongs to an Appsmith maintainer external-contribution Pull request submitted from outside the Appsmith repository labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Thanks for contributing to Appsmith!

Credential-free formatting, lint, type, and unit checks will run after GitHub's workflow approval. An Appsmith maintainer will start privileged integration tests or a deploy preview when needed.

No action is required from you while this PR has the awaiting-maintainer label.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6dc43dbb-cf8a-4ada-bee7-6f440dd6f621

📥 Commits

Reviewing files that changed from the base of the PR and between 81da26b and 39f6c81.

📒 Files selected for processing (5)
  • app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts
  • app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
  • app/client/src/widgets/wds/WDSPhoneInputWidget/widget/index.tsx
  • app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java
  • app/server/appsmith-plugins/anthropicPlugin/src/main/java/com/external/plugins/commands/VisionCommand.java

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


Walkthrough

The changes update REST datasource authentication defaults, restrict OAuth2 expiration input rendering, clear phone widget text on reset, avoid large-file S3 MD5 headers, and default blank Anthropic vision message types to text.

Changes

REST datasource authentication

Layer / File(s) Summary
Authentication defaults and OAuth2 mapping
app/client/src/PluginActionEditor/transformers/RestAPIDatasourceFormTransformer.ts
Missing authentication data now defaults to an empty object. OAuth2 defaults to client credentials when no grant type is recognized. Basic, API key, and bearer fields use empty-string fallbacks.
OAuth2 expiration field rendering
app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx
The expiration input renders only for the AuthorizationCode grant type.

Phone input reset

Layer / File(s) Summary
Reset text state
app/client/src/widgets/wds/WDSPhoneInputWidget/widget/index.tsx
Reset now clears text and removes rawText through batched metadata updates.

S3 upload handling

Layer / File(s) Summary
Large-file Content-MD5 handling
app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java
The upload code sets Content-MD5 only when the payload is below the multipart upload threshold.

Anthropic vision messages

Layer / File(s) Summary
Default vision message type
app/server/appsmith-plugins/anthropicPlugin/src/main/java/com/external/plugins/commands/VisionCommand.java
Blank or missing message types now default to TEXT.

Priority: ⬆️ High — Impact reflects high issue severity.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: High

Merge Risk: ⚪ Minimal · up to 39f6c

No actionable merge-blocking risk is confirmed for the current changes.

Suggested reviewers: sondermanish

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes unrelated changes to REST API authentication handling, OAuth2 form rendering, WDSPhoneInputWidget reset behavior, and Anthropic vision message handling. These changes are not related t… Remove the unrelated client and Anthropic plugin changes, or move them to separate pull requests with their own linked issues and objectives.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: fixing S3 BadDigest errors for large file uploads.
Description check ✅ Passed The description includes the problem, solution, linked issue, change type, and testing information. The validation checklist and communication section are not completed, but the description is otherwi…
Linked Issues check ✅ Passed The S3 change satisfies issue #41971 by avoiding the overall Content-MD5 header for payloads that use multipart upload, while retaining the header for smaller uploads.
Full details: Out of Scope Changes check

Explanation

The PR includes unrelated changes to REST API authentication handling, OAuth2 form rendering, WDSPhoneInputWidget reset behavior, and Anthropic vision message handling. These changes are not related to issue #41971.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


Empty fields find sensible shapes,
OAuth forms reveal the right gates.
Phone text clears in one small sweep,
S3 avoids checks it cannot keep.
Vision messages speak as text,
Defaults guide the data next.

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

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

Labels

awaiting-maintainer The next action on this pull request belongs to an Appsmith maintainer external-contribution Pull request submitted from outside the Appsmith repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants