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

fix: set baseApiUrl rather than assign config.API_URL which is now a getter #395

Merged
merged 1 commit into from
Jun 3, 2023

Conversation

sandikbarr
Copy link
Contributor

@sandikbarr sandikbarr commented Mar 27, 2023

As mentioned in #390 setting the customMapboxApiUrl on the map component is throwing an error that it is unable to set property API_URL on config which is now a getter.

ngx-mapbox-gl.mjs:767 Uncaught TypeError: Cannot set property config of [object Module] which has only a getter
    at MapService.assign (ngx-mapbox-gl.mjs:767:1)
    at ngx-mapbox-gl.mjs:34:1
    at Object.next (Subscriber.js:123:1)
    at Subscriber._next (Subscriber.js:63:1)
    at Subscriber.next (Subscriber.js:34:1)
    at throwIfEmpty.js:10:1
    at OperatorSubscriber._this._next (OperatorSubscriber.js:11:1)
    at Subscriber.next (Subscriber.js:34:1)
    at take.js:12:1
    at OperatorSubscriber._this._next (OperatorSubscriber.js:11:1)

Mapbox provides a baseApiUrl option that can be set on mapboxgl, example:

mapboxgl.baseApiUrl = 'https://api.mapbox.com';

How to test:
Set the customMapboxApiUrl input on the map component using the default value for Mapbox Cloud, "https://api.mapbox.com" (I am using this with an alternate Mapbox url, but the error will be shown if the config.API_URL is assign when customMapboxApiUrl is set.)

@nx-cloud
Copy link

nx-cloud bot commented Mar 27, 2023

☁️ Nx Cloud Report

We didn't find any information for the current pull request with the commit a8c9426.
You might need to set the 'NX_BRANCH' environment variable in your CI pipeline.

Check the Nx Cloud Github Integration documentation for more information.


Sent with 💌 from NxCloud.

@sandikbarr
Copy link
Contributor Author

@Wykks any thoughts on this fix?

@Wykks
Copy link
Owner

Wykks commented Jun 3, 2023

Hi!

Looks good to me! Sorry for the delay

@Wykks Wykks merged commit 2078155 into Wykks:main Jun 3, 2023
denisyilmaz pushed a commit to denisyilmaz/ngx-mapbox-gl that referenced this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants