Closed dan-lee closed 5 months ago
Also noticed this and reported in the Discord. However i am using "@clerk/backend": "^0.37.3",
for what it is worth. Lets me believe i should maybe downgrade my version and see if that works.
https://discord.com/channels/856971667393609759/1202572778792816670
@dan-lee Any chance the code is running in an edge-runtime ?
@panteliselef Yeah that's right, the code is running a Cloudflare Worker
Preliminary Checks
Reproduction / Replay Link
n/a
Publishable key
n/a
Description
Steps to reproduce:
Create a clerk client with the latest beta version (
1.0.0-beta-v5.18
) and get an organization.Expected behavior:
Get back org correctly
Actual behavior:
It throws an error with
Invalid URL string
.I tried to hunt it down and maybe found the problem:
https://github.com/clerk/javascript/blob/9289aafd0ac5178bef355a3410e3d7e120e51482/packages/backend/src/api/request.ts#L64-L67
joinPaths
is responsible to remove double path joiners (when is it ever not a slash?):https://github.com/clerk/javascript/blob/9289aafd0ac5178bef355a3410e3d7e120e51482/packages/backend/src/util/path.ts#L7-L10
Now the args of joinPaths look something like this:
["https://api.clerk.com", "v1", "/organizations/org_xxxxxxxxxxxxxxxxx"]
Unfortunately, the protocol contains a double slash as well and the result of
url
is:Notice the
https:/
.new URL
will throw with this input