[bug]: Strapi client fail to initialize due to URL.canParse() method unavailable
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- angular, typescript
Research direction
Start by reproducing the initialization failure in an Angular 19 project using an older browser without URL.canParse(). Check how the Strapi client initializes and how the documented core-js URL polyfill can be included. Done means the client initializes successfully on browsers lacking URL.canParse().
Written by the indexing model from the issue text.
Description
Bug Description
I'm encountouring an issue with strapi client, the console throw this error:
Could not initialize the Strapi Client
I figured out that using the strapi client library on typescript project leads to browser incompatibility with the URL.canParse() function. In my case it happens on "old" devices with different browsers and browser versions that are not supporting this method.
The solution to solve the problem is to use polyfills:
https://github.com/zloirock/core-js#url-and-urlsearchparams
Steps to Reproduce
- Create an Angular 19 project
- Install the strapi client library
- Instanciate an instance of the strapi client
- Browse to your app on an old browser that doesn't support URL.canParse() method
Expected Behavior
The method polyfill should be implemented into the library to prevent getting this error on old browsers versions.
Here is the list of browsers and the versions that supports the method:
https://developer.mozilla.org/en-US/docs/Web/API/URL/parse_static
Version
1.4.0
Operating System
Other
Runtime Environment
Browser
Logs
Media
Confirmation Checklist
- I have checked the existing issues
- I agree to follow this project's Code of Conduct
- I would like to work on this issue
- Dominant language
- TypeScript
- Stars
- 83
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from strapi/client
-
issue: bug status: to be confirmed
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
issue: enhancement
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
issue: enhancement
Difficulty 5/5 Over a week Newbie friendliness 48/100
-
issue: enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
issue: bug source: client status: to be confirmed
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·