[GH-ISSUE #1736] internal.seal-document fails when using s3 transport & backblaze b2 #499

Open
opened 2026-02-26 18:47:19 +03:00 by kerem · 3 comments
Owner

Originally created by @AtumG on GitHub (Mar 30, 2025).
Original GitHub issue: https://github.com/documenso/documenso/issues/1736

Issue Description

Document seal operations are failing when I try to use backblaze b2 as an S3 storage option. I've set NEXT_PUBLIC_UPLOAD_TRANSPORT=s3 in my .env file along with the relevant S3 related env variables.

I am able to make a successful post request to /api/v1/documents and get an s3 upload url (or in my case a backblaze b2 url) I also can verify that files are being created in the bucket when I upload via the web UI.

Here's the problem:
When I sign a document, the internal.seal-document job kicks off but ends up in a non-stop fail loop because of a invalid padding error.

Before this, I've been using local storage, or in other words.. not setting the upload transport .env var. I'm using a self signed .p12 at this time and everything has worked flawlessly before changing to the s3 transport. Here's a sample of the logs when running the docker contianer.

documenso-1  | [JOBS]: Job internal.seal-document failed Error: Invalid padding: string should have whole number of bytes
documenso-1  |     at decode (file:///app/node_modules/@scure/base/lib/esm/index.js:103:23)
documenso-1  |     at file:///app/node_modules/@scure/base/lib/esm/index.js:15:37
documenso-1  |     at Object.decode (file:///app/node_modules/@scure/base/lib/esm/index.js:15:35)
documenso-1  |     at D (/app/apps/web/.next/server/chunks/9182.js:1:1166382)
documenso-1  |     at /app/apps/web/.next/server/chunks/9182.js:1:1166269
documenso-1  |     at $.with (file:///app/node_modules/ts-pattern/dist/index.js:1:6458)
documenso-1  |     at I (/app/apps/web/.next/server/chunks/9182.js:1:1166236)
documenso-1  |     at Object.handler (/app/apps/web/.next/server/chunks/9783.js:1:29345)
documenso-1  |     at async /app/apps/web/.next/server/chunks/9783.js:1:17053
documenso-1  |     at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853)
documenso-1  | Submitting job to endpoint: http://172.20.0.2:3010/api/jobs/internal.seal-document/cm8v8fxgp0018mi2n97e3vj01
documenso-1  | [JOBS]: Triggering job internal.seal-document with payload {
documenso-1  |   documentId: 543,
documenso-1  |   requestMetadata: {
documenso-1  |     ipAddress: 'REDACTED:ipv6',
documenso-1  |     userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36'
documenso-1  |   }
documenso-1  | }

Steps to Reproduce

  1. Set Upload transport to S3
  2. configure related .env vars for a backblaze b2 bucket
  3. start docker container via docker compose up
  4. upload a document via the web ui and confirm its in the bucket
  5. sign the document
  6. see an endless stream of the error above in the console
  7. documents cannot be dowloaded in the web ui

Expected Behavior

document sealing via s3 compatible transport should not create errors

Current Behavior

document sealing fails with s3 transport and backblaze b2 bucket

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

Ubuntu 22

Browser [e.g., Chrome, Firefox]

Chrome

Version [e.g., 2.0.1]

No response

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.
  • I want to work on creating a PR for this issue if approved
Originally created by @AtumG on GitHub (Mar 30, 2025). Original GitHub issue: https://github.com/documenso/documenso/issues/1736 ### Issue Description Document seal operations are failing when I try to use backblaze b2 as an S3 storage option. I've set `NEXT_PUBLIC_UPLOAD_TRANSPORT=s3` in my .env file along with the relevant S3 related env variables. I am able to make a successful post request to /api/v1/documents and get an s3 upload url (or in my case a backblaze b2 url) I also can verify that files are being created in the bucket when I upload via the web UI. Here's the problem: When I sign a document, the internal.seal-document job kicks off but ends up in a non-stop fail loop because of a invalid padding error. Before this, I've been using local storage, or in other words.. not setting the upload transport .env var. I'm using a self signed .p12 at this time and everything has worked flawlessly before changing to the s3 transport. Here's a sample of the logs when running the docker contianer. ``` documenso-1 | [JOBS]: Job internal.seal-document failed Error: Invalid padding: string should have whole number of bytes documenso-1 | at decode (file:///app/node_modules/@scure/base/lib/esm/index.js:103:23) documenso-1 | at file:///app/node_modules/@scure/base/lib/esm/index.js:15:37 documenso-1 | at Object.decode (file:///app/node_modules/@scure/base/lib/esm/index.js:15:35) documenso-1 | at D (/app/apps/web/.next/server/chunks/9182.js:1:1166382) documenso-1 | at /app/apps/web/.next/server/chunks/9182.js:1:1166269 documenso-1 | at $.with (file:///app/node_modules/ts-pattern/dist/index.js:1:6458) documenso-1 | at I (/app/apps/web/.next/server/chunks/9182.js:1:1166236) documenso-1 | at Object.handler (/app/apps/web/.next/server/chunks/9783.js:1:29345) documenso-1 | at async /app/apps/web/.next/server/chunks/9783.js:1:17053 documenso-1 | at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16853) documenso-1 | Submitting job to endpoint: http://172.20.0.2:3010/api/jobs/internal.seal-document/cm8v8fxgp0018mi2n97e3vj01 documenso-1 | [JOBS]: Triggering job internal.seal-document with payload { documenso-1 | documentId: 543, documenso-1 | requestMetadata: { documenso-1 | ipAddress: 'REDACTED:ipv6', documenso-1 | userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36' documenso-1 | } documenso-1 | } ``` ### Steps to Reproduce 1. Set Upload transport to S3 3. configure related .env vars for a backblaze b2 bucket 4. start docker container via docker compose up 5. upload a document via the web ui and confirm its in the bucket ✅ 6. sign the document 7. see an endless stream of the error above in the console 8. documents cannot be dowloaded in the web ui ### Expected Behavior document sealing via s3 compatible transport should not create errors ### Current Behavior document sealing fails with s3 transport and backblaze b2 bucket ### Screenshots (optional) _No response_ ### Operating System [e.g., Windows 10] Ubuntu 22 ### Browser [e.g., Chrome, Firefox] Chrome ### Version [e.g., 2.0.1] _No response_ ### Please check the boxes that apply to this issue report. - [x] I have searched the existing issues to make sure this is not a duplicate. - [x] I have provided steps to reproduce the issue. - [x] I have included relevant environment information. - [ ] I have included any relevant screenshots. - [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [ ] I want to work on creating a PR for this issue if approved
Author
Owner

@codersboutique commented on GitHub (Apr 14, 2025):

i am having same issue

<!-- gh-comment-id:2800379806 --> @codersboutique commented on GitHub (Apr 14, 2025): i am having same issue
Author
Owner

@aleksander-pankow commented on GitHub (Apr 21, 2025):

The same. After signing - doc is pending.
Latest ver, dokploy.

<!-- gh-comment-id:2818319198 --> @aleksander-pankow commented on GitHub (Apr 21, 2025): The same. After signing - doc is pending. Latest ver, dokploy.
Author
Owner

@NickCirculy commented on GitHub (Jul 10, 2025):

I had the exact same problem.

what worked for me in the end:
-> re-upload the template / document to ensure the file exist within S3.

<!-- gh-comment-id:3057976723 --> @NickCirculy commented on GitHub (Jul 10, 2025): I had the exact same problem. what worked for me in the end: -> re-upload the template / document to ensure the file exist within S3.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#499
No description provided.