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

Unable to remove pinned item #1981

Open
acourter27 opened this issue Sep 30, 2022 · 9 comments
Open

Unable to remove pinned item #1981

acourter27 opened this issue Sep 30, 2022 · 9 comments
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@acourter27
Copy link

There's a pinned CID on my account that I'm unable to remove. When I try using the Pinning API to list all pins, it comes back with "Instance does not have required property /"status/"."

I've tried running the command to remove the PIN using the right Request ID, but it tells me "API token no longer valid". I've tried with multiple tokens including ones I had just created, but nothing works.

I've also tried from the GUI and it "deletes" but then is still there.

I didn't care before but now that storage space may be something I need to pay attention to, I'd like to know how to get that cleaned up.

@acourter27 acourter27 added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Sep 30, 2022
@dchoi27
Copy link
Contributor

dchoi27 commented Oct 10, 2022

@mbommerez mind getting someone on the team to take a look?

@mbommerez
Copy link

@dchoi27 Will do!

@flea89 flea89 self-assigned this Oct 12, 2022
@flea89
Copy link
Contributor

flea89 commented Oct 12, 2022

Hi @acourter27, thanks for reporting the issue.

When I try using the Pinning API to list all pins, it comes back with "Instance does not have required property /"status/"."

For the list to work you need to pass a status query param to list of the PinRequest you'd like to get:

ie.
https://api.web3.storage/pins?/?status=pinned to list the succesfully pinned requests.
https://api.web3.storage/pins?/?status=failed,pinned,pinning,queued to list all your pin requests.

There's some discussion around status not being "required", but rather not-empty if provided, but at the moment the API expects it.

I've tried running the command to remove the PIN using the right Request ID, but it tells me "API token no longer valid". I've tried with multiple tokens including ones I had just created, but nothing works.

Can you provide a bit more context on how you're trying to do this?

I've just tested adding a file and removing it with a given token and it works as expected.

I suspect you might be trying to delete a PinRequest through the delete enpoint with a "deleted" token, but unfortunately it's not possibile.
Is that what you're trying to do?
If yes, that's currently a limitation and we're looking into having the website dashboard to show all the pins (also the once for deleted tokes) and le user delete from there in this issue

Please let me know if this answers your question and don't hesitate to add context to the issue.

@flea89 flea89 removed their assignment Oct 12, 2022
@acourter27
Copy link
Author

@flea89 I removed the extra "/?" and the command succeeded, but shows that the count is zero. However, on the GUI it still shows a pinned file.

I ran the second query as well in case it wasn't fully "pinned", but it also came back with {"count":0,"results":[]}.

Curl command I ran:
curl -X GET 'https://api.web3.storage/pins?status=failed,pinned,pinning,queued' \ --header 'Accept: */*' \ --header 'Authorization: Bearer _redacted key_'

For the delete command, I was trying to run this:
curl -X DELETE 'https://api-staging.web3.storage/pins/1e23aa31-d6e2-43cd-9e6f-098773967ca3' \ --header 'Accept: */*' \ --header 'Authorization: Bearer _redacted key_'

For that, I get this response:
{"error":{"reason":"ERROR_TOKEN_NOT_FOUND","details":"API token no longer valid"}}

The key being used was the same on both, so I know it's still valid. I'm not sure what a "deleted token" would be in this regard. I've pinned & removed other files without any issues, but this one file won't remove.

A screenshot of what I see on the GUI: https://p172.p4.n0.cdn.getcloudapp.com/items/X6uQ76gA/abfda5de-86f1-41be-8567-7450c61a466f.jpg?v=250bf08cdd046d66d4b59f5c8563487a

@flea89
Copy link
Contributor

flea89 commented Oct 25, 2022

@acourter27 thanks for the context.

So as it stands right now, pin requests are scoped by API token ( the ones you see here).
That means that if you tried to pin a CID with token_a and then you hit any endpoint using token_b, you won't be able to access that data. No you won't see it in the list, and trying to delete will return Anauthorized.

On UI, on the other hand, you can see all the requests done by the user, so you will see all the request despite the token you used.

I've created a PR that hopefully should allow you to delete the file from the UI here.

Keep an eye on it, it should hopefully solve your issue 🤞

@acourter27
Copy link
Author

It looks like that PR was merged into main, but I tried deleting the pinned item via the GUI today and it still didn't work. Was it released after the merge?

@flea89
Copy link
Contributor

flea89 commented Dec 12, 2022

@acourter27 thanks for your message.
The PR is merged but not released yet, hopefully, it will early this week.
You can get updates about it here.

Thanks

@mbommerez
Copy link

@acourter27 This has now been released.

@acourter27
Copy link
Author

Worked as expected; thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

5 participants