flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

fix: Frontend error when creating SAML configuration if API URL is relative

Open rolodato opened this issue 1 year ago • 3 comments

Thanks for submitting a PR! Please check the boxes below:

  • [x] I have added information to docs/ if required so people know about the feature!
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

If Project.api points to a relative URL such as /api/v1, clicking on "Create SAML Configuration" or opening an existing SAML configuration results in an error:

Uncaught TypeError: URL constructor: /api/v1/ is not a valid URL.
    CreateSAML CreateSAML.tsx:58

This does not happen with the default npm run dev because we're setting an absolute URL of http://localhost:8000/api/v1/. To reproduce this bug locally, have the FE proxy requests to the BE by running like this:

FLAGSMITH_PROXY_API_URL=http://127.0.0.1:8000 npm run dev

How did you test this code?

Manually - using flagsmith/flagsmith-private-cloud as the API, try to create a SAML configuration or edit an existing one.

rolodato avatar Oct 18 '24 21:10 rolodato