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] - Url with api key gets trimmed #1599

Closed
Tracked by #1640
ali-mirik opened this issue Dec 19, 2024 · 3 comments · Fixed by #1652
Closed
Tracked by #1640

🐛 [BUG] - Url with api key gets trimmed #1599

ali-mirik opened this issue Dec 19, 2024 · 3 comments · Fixed by #1652
Assignees
Milestone

Comments

@ali-mirik
Copy link

ali-mirik commented Dec 19, 2024

Description

When i use a client created with a custom node i got from NowNodes (which is in the form: https://vet.nownodes.io/<api-key>/), the api key part gets lost due to new URL(path, baseURL) when making a request.

How to fix:
the prefix of '/' should be removed from endpoints in thorest object in utils.

URL constructor examples:

new URL('/blocks/0', 'https://myNode.com/api-key').toString() = 'myNode.com/blocks/0'
new URL('/blocks/0', 'https://myNode.com/api-key/').toString() = 'myNode.com/blocks/0'
new URL('blocks/0', 'https://myNode.com/api-key').toString() = 'myNode.com/blocks/0'
new URL('blocks/0', 'https://myNode.com/api-key/').toString() = 'myNode.com/api-key/blocks/0'

Reproduction URL

No response

Reproduction steps

1. Create a client that is not a simple domain (i.e. https://example.com/some-text/)
2. Make a request to any endpoint. I use getGenesisBlock which sends a request to `/blocks/0`

Screenshots

No response

Logs

No response

OS

No response

@dev-dantealighieri
Copy link

hi,

omg this is very critical bug, i cannot use providers cuz of dis, please solve this man, can you release a hotfix just for this danke schon

thanks, dante

@dev-dantealighieri
Copy link

@victhorbi
Copy link
Collaborator

hello @dev-dantealighieri ,
we have analysed it and shouldn't be hard to fix.

Yes, we will fix it in the next version, we should do one by tomorrow.

@fabiorigam fabiorigam linked a pull request Jan 9, 2025 that will close this issue
@victhorbi victhorbi mentioned this issue Jan 10, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants