-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: delegations model tries to handle if row.bytes is Array not Buff…
…er (e.g. cloudflare) (#478) ## Rationale This is the error I get from staging atm (on `access/claim`) ``` claimResult { name: 'HandlerExecutionError', cause: { row: { cid: 'bafyreihqswtsrxvsp2pqf5a2jjiyb6zks3hynbfkhga7odwbat4ptxrf5e', bytes: [Array], issuer: 'did:mailto:dag.house:bengo', audience: 'did:key:z6MkkUymFxGqXWRqFNiaU4jCa2efexfDCNADqD7sQK3RbU2j', expiration: null, updated_at: '2023-03-03T16:41:54.999Z', inserted_at: '2023-03-03T16:41:54.999Z' }, name: 'UnexpectedDelegation', stack: 'UnexpectedDelegation: failed to create delegation from row\n' + ``` Notably `bytes` is `Array` here. Locally and in node.js, I think miniflare gives back a `Buffer` and (in nodejs) [this catches it](https://github.com/web3-storage/w3protocol/blob/a6dafcb0c44b20fa87bbe81d7a982fb13387084e/packages/access-api/src/utils/d1.js#L77). But on cloudflare. This PR would cast the bytes column on delegations model to Uint8Array if the db/kysely hand it back as an Array. --------- Co-authored-by: Irakli Gozalishvili <[email protected]>
- Loading branch information
Showing
4 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters