synapse-sdk: StoreError buries the root cause under repeated wrapper messages
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend-api-design
Research direction
Start with packages/synapse-sdk/src/storage/context.ts at StorageContext.store() and packages/synapse-sdk/src/storage/manager.ts where StoreError is built; then read the SynapseError cause handling in packages/synapse-core/src/errors/base.ts. Check the existing message assertions in storage.test.ts and synapse.test.ts. Done means StoreError names the provider once and presents the deepest typed error’s short message and details without repeating wrapper messages.
Written by the indexing model from the issue text.
Description
Follow-up to #841. #1175 makes synapse-core throw InvalidUploadSizeError instead of NetworkError. The SDK still wraps that error twice, and each wrapper copies in the full message of the error directly below it. A consumer such as filecoin-pin that shows StoreError.message gets the real cause, but buried and repeated:
Failed to store piece on service provider 2 (https://calib2.ezpdpz.net)
Details: StorageContext store failed: Failed to store piece on service provider - Invalid upload size.
Details: Size 125 bytes is below minimum allowed size of 127 bytes or exceeds maximum ...
(This output is worked out from the code, not captured from a run.)
Where it comes from
StorageContext.store()wraps the core error withcreateError(). That gives a plainErrorwhose message isStorageContext store failed: Failed to store piece on service provider - <the core error's full message>.StorageManagerwraps that in aStoreErrorwith the same "Failed to store piece on service provider" text.SynapseErrorfills indetailsfromcause.messagewhen no details are given. That copies the whole message from step 1, including the core error's ownDetails:line.
The typed error is still there at error.cause.cause, so code can find it. Only the message is hard to read.
Expected
The StoreError message names the provider once and shows the deepest SynapseError's shortMessage and details:
Failed to store piece on service provider 2 (https://calib2.ezpdpz.net)
Details: Invalid upload size. Size 125 bytes is below minimum allowed size of 127 bytes ...
Possible fixes
These are #841's suggestions 2 and 3:
- In
StorageContext.store(), rethrow aSynapseErrorfrom core unchanged, or wrap it in a typed error that passes on itsdetails, instead of usingcreateError(). - When building
StoreErrordetails, look down thecausechain for the deepestSynapseErrorand use itsshortMessageanddetails, not the message of the error directly below.
Existing tests check the message for 'Failed to store piece on service provider' (storage.test.ts, synapse.test.ts). They should keep passing, or be updated deliberately.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 36
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FilOzone/synapse-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FilOzone/synapse-sdk#1201 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
FilOzone/synapse-sdk#1198 · 1 comment ·
Maintainers usually reply within 1 day
-
Clarify add pieces and create set can be made concurrentlyPossibly taken @hugomrdias claimed this 22 days ago. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
FilOzone/synapse-sdk#749 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Upload to restricted data sets with `read: "restricted"`Possibly taken @JAG-UK claimed this today. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
FilOzone/synapse-sdk#1197 · 2 comments ·
Maintainers usually reply within 1 day
-
Pull second copies from `/download` with per-piece FOC grantsPossibly taken @JAG-UK claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
FilOzone/synapse-sdk#1196 · 1 comment ·
Maintainers usually reply within 1 day
All issues in FilOzone/synapse-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zabuton-app/meguri#875 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
iruzen-dono/workless#117 ·
Maintainers usually reply within 1 day
-
area:api area:web wave wave:trivial
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
vetro-protocol/vetro-monorepo#1321 ·
Maintainers usually reply within 1 day