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.
import{createClerkClient}from'@clerk/backend'constclerk=createClerkClient({secretKey: env.CLERK_SECRET_KEY,})constorg=awaitctx.clerk.organizations.getOrganization({organizationId: 'org_xxxxxxxxxxxxxxxxx',})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:
| consturl=joinPaths(apiUrl,apiVersion,path); |
| |
| // Build final URL with search parameters |
| constfinalUrl=newURL(url); |
joinPaths is responsible to remove double path joiners (when is it ever not a slash?):
| returnargs |
| .filter(p=>p) |
| .join(SEPARATOR) |
| .replace(MULTIPLE_SEPARATOR_REGEX,SEPARATOR); |
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:
https:/api.clerk.com/v1/organizations/org_xxxxxxxxxxxxxxxxx
Notice the https:/. new URL will throw with this input
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:
javascript/packages/backend/src/api/request.ts
Lines 64 to 67 in 9289aaf
joinPathsis responsible to remove double path joiners (when is it ever not a slash?):javascript/packages/backend/src/util/path.ts
Lines 7 to 10 in 9289aaf
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
urlis:Notice the
https:/.new URLwill throw with this input