Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw error if upload file or metadata to ChainSafe IPFS fails #951

Closed
juans-chainsafe opened this issue May 13, 2024 · 5 comments
Closed
Assignees
Labels
Priority: P2 Added to issues and PRs relating to a medium severity bugs. Type: Bug Added to issues and PRs if they are addressing a bug

Comments

@juans-chainsafe
Copy link
Contributor

Describe the bug
If you are using IPFS samples and a failed response happens from Storage API, we are not catching that error and we return the IPFS anyways, so the dev doesn't now that something failed.

Steps
Steps to reproduce the behavior:

  1. In SampleMain set in IPFS Calls script the Bucket ID and API key from https://app.storage.chainsafe.io/
  2. Use the scene [SampleLogin or SampleLogin - Web3Auth]
  3. Login with [Web3Auth or Remote wallet]
  4. Click on "Upload Metadata" sample
  5. Click again in "Upload Metadata" sample

Expected behavior

  • An error is displayed based on the API response due that there is a conflict with the file (because is duplicated)
  • We need to verify the "status" field inside "file_details" object in the API response and show the "message" field if status is "failed"

Console errors
This is the API response in case of a conflict:

{
    "path": "/test",
    "files_details": [
        {
            "path": "/test/package.json",
            "cid": "QmbqtW6GFZofCGa41rqDhhyznFLKoGZ5LPSBAhxFeGH2gV",
            "content_type": "application/json",
            "size": 2103,
            "status": "failed",
            "error_code": 409,
            "message": "path:/test/package.json, conflict, entry can't be added",
            "suggestion": "/test/package(1).json"
        }
    ]
}

Screenshots/Video
329930806-68bff7d7-b541-4aa5-bf81-807949638209

@juans-chainsafe juans-chainsafe added Priority: P2 Added to issues and PRs relating to a medium severity bugs. Type: Bug Added to issues and PRs if they are addressing a bug labels May 13, 2024
@juans-chainsafe
Copy link
Contributor Author

Issue is related to #949

@sneakzttv sneakzttv self-assigned this May 13, 2024
@sneakzttv
Copy link
Contributor

sneakzttv commented May 14, 2024

I'm getting a different response unity side when uploading the same metadata file twice

{
"content": 
{
"name":"MetaData.json",
"cid":"Qmdf8XcXn8HepJpWFA1cYmiXVQa6t6YSto2GN7GLskwFUY",
"content_type":"application/octet-stream",
"size":379,
"version":1,
"created_at":1715576819
},
"persistent":null,"messages":null
}

@juans-chainsafe
Copy link
Contributor Author

I'm getting a different response unity side when uploading the same metadata file twice

{
"content": 
{
"name":"MetaData.json",
"cid":"Qmdf8XcXn8HepJpWFA1cYmiXVQa6t6YSto2GN7GLskwFUY",
"content_type":"application/octet-stream",
"size":379,
"version":1,
"created_at":1715576819
},
"persistent":null,"messages":null
}

Looks like we will need this ticket to be done first ChainSafe/ui-monorepo#2270

@sneakzttv
Copy link
Contributor

sneakzttv commented May 14, 2024

will check back later then, i can just make it throw based on the returned class members value, no probs.

@juans-chainsafe
Copy link
Contributor Author

I'm getting a different response unity side when uploading the same metadata file twice

{
"content": 
{
"name":"MetaData.json",
"cid":"Qmdf8XcXn8HepJpWFA1cYmiXVQa6t6YSto2GN7GLskwFUY",
"content_type":"application/octet-stream",
"size":379,
"version":1,
"created_at":1715576819
},
"persistent":null,"messages":null
}

Looks like we will need this ticket to be done first ChainSafe/ui-monorepo#2270

My bad, this is for the Storage UI, not the API.
We should be able to see the error details in the response of the /upload endpoint and not the /file endpoint
cc @sneakzttv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P2 Added to issues and PRs relating to a medium severity bugs. Type: Bug Added to issues and PRs if they are addressing a bug
Projects
None yet
Development

No branches or pull requests

2 participants