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

Bug in getPositions() (401 Unauthorized) #4

Closed
azidyn opened this issue Apr 20, 2021 · 4 comments
Closed

Bug in getPositions() (401 Unauthorized) #4

azidyn opened this issue Apr 20, 2021 · 4 comments

Comments

@azidyn
Copy link

azidyn commented Apr 20, 2021

Not sure if this is a bug or I'm doing something wrong but getPositions() fails with a 401.

If I bypass and call directly via client.requestWrapper.get('positions'); it works correctly.

@tiagosiebler
Copy link
Owner

This sounds like an unusual bug actually. If you don't provide any parameters in your getPositions() call, it actually triggers the equivalent of requestWrapper.get('positions?');:
https://github.com/tiagosiebler/ftx-api/blob/master/src/rest-client.ts#L171-L172

Could you try if the issue happens via this too? client.requestWrapper.get('positions?');

@azidyn
Copy link
Author

azidyn commented Apr 20, 2021

Can confirm that client.requestWrapper.get('positions?') (with question mark) produces the 401 error. Removing the ? fixes the problem, how strange!

tiagosiebler pushed a commit that referenced this issue Apr 20, 2021
tiagosiebler added a commit that referenced this issue Apr 20, 2021
@tiagosiebler
Copy link
Owner

Thanks for confirming! It was silly of me to suffix endpoints with ? even when an optional parameter isn't included, although I wasn't expecting that to cause any issues with signed requests... I've pushed a fix that seems to be working on my end.

Can you try the latest version (v1.0.3) and confirm?

npm install ftx-api@latest

@azidyn
Copy link
Author

azidyn commented Apr 23, 2021

Yes, can confirm the fix is working correctly. (Sorry for delay!)

@azidyn azidyn closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants