#3282·documenso

Sealing fails against S3 buckets with Object Lock enabled — requestChecksumCalculation is hardcoded to WHEN_REQUIRED

Author: egoochJPXCreated Aug 20, 2026Updated Sep 29, 2026
Labelsstatus: backlogged

Issue Description

When the upload bucket has S3 Object Lock enabled, document sealing fails and documents remain stuck in PENDING after all recipients have signed.

The seal job retries three times and then gives up with:

[JOBS:task-...] Task failed InvalidRequest: Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters at AwsRestXmlProtocol.handleError (/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js) [JOBS]: Job internal.seal-document failed BackgroundTaskExceededRetriesError: Task exceeded retries

S3 requires a Content-MD5 or x-amz-checksum-* header on any PutObject request that carries Object Lock parameters. packages/lib/universal/upload/providers/s3-provider.ts sets:

ts requestChecksumCalculation: 'WHEN_REQUIRED', responseChecksumValidation: 'WHEN_REQUIRED',

The in-code comment explains why — S3-compatible providers such as GarageHQ, MinIO and Backblaze B2 reject the AWS SDK's default CRC32 checksums with InvalidDigest. That is a reasonable default, but it is not overridable: because the value is set explicitly on the client, the standard AWS_REQUEST_CHECKSUM_CALCULATION environment variable has no effect.

Uploads are unaffected because they use a presigned browser POST, which carries no Object Lock parameters. Only the server-side seal write fails.

Steps to Reproduce

Configure NEXT_PUBLIC_UPLOAD_TRANSPORT=s3 against a real AWS S3 bucket Enable Object Lock on that bucket with a default retention period Create a document, send it, and have all recipients sign Sealing fails; the document stays PENDING and appears under Admin → Unsealed Documents

Expected Behavior

Sealing succeeds against buckets with Object Lock enabled, or the checksum behaviour is configurable so operators who need it can opt in without patching.

Current Behavior

Make it configurable while keeping the current default, so third-party S3-compatible backends are unaffected:

requestChecksumCalculation: env('NEXT_PRIVATE_UPLOAD_CHECKSUM_CALCULATION') === 'WHEN_SUPPORTED' ? 'WHEN_SUPPORTED' : 'WHEN_REQUIRED',

The ternary preserves the literal union type so tsc stays happy — reading the env value directly widens it to string and fails typecheck.

Verified against v2.16.0: with NEXT_PRIVATE_UPLOAD_CHECKSUM_CALCULATION=WHEN_SUPPORTED, previously stuck documents seal successfully and the completion email is delivered with the signed PDF attached.

Happy to open a PR if this approach looks right.

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

Ubuntu 24.04.3 LTS

Browser [e.g., Chrome, Firefox]

Chrome

Version [e.g., 2.13.0]

2.16.0

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.