JoseLuisGJ / figmap

Fully customizable styled maps and markers for Figma
16 stars 3 forks source link

Custom style not loading #8

Closed steveddan closed 2 months ago

steveddan commented 10 months ago

When I enter my username and style ID for a custom style, the map turns blank. I am wondering if my access token is additionally needed to get the custom style to load.

image

Thanks for your help!

craftycram commented 10 months ago

can confirm. got the same issue

craftycram commented 10 months ago

Further update. I get a 404 Not Found response from mapbox in the console

craftycram commented 10 months ago

Another update. I tried copying the request from the console and just replace your access token with mine that worked.
Forking and replacing your access token with mine in code and loading that plugin also worked.
Seems like your access token seems to be the issue.
Maybe change the token or give users the option to provide their own it else is too expensive for you

JoseLuisGJ commented 10 months ago

Thanks for the feedback @steveddan and @craftycram it's something that I tried to manage in the past without success. Seems that the react Mapbox library I'm using doesn't update the Mapbox API token. I already opened an issue here hopping to solve it once I get an answer.

Simo-DA commented 4 months ago

Same problem here...

JoseLuisGJ commented 4 months ago

Thanks for your patience @steveddan @craftycram and @Simo-DA . I recently published a new version and I made some tests and it's working for me. Can you check it again? thanks.

craftycram commented 4 months ago

still getting a 404 error… not sure why tho

craftycram commented 4 months ago

After lookin into it I still think that the access token could be the issue. Taking the request figmap does and replacing your access token with mine resolves the issue.
Maybe change the input fields of figmap to style url and access token?

Just like you can copy here:

grafik
craftycram commented 4 months ago

Like mentioned before I'm using a forked version of FigMap where I just replaced the access token to make it work. Having no issues at all.

JoseLuisGJ commented 4 months ago

@craftycram did you check wether your map style was published and public available? I created 2 temp accounts in Mapbox to try it out one more time. And it's easy to believe that your map style is public but by default it's not and when it's not public is when you get this 404 error fetching this data with a token not scoped for that style.

Makes sense if you can see your style changing also the Mapbox access token forking the repo due to this token scopes the styles you own for that account.

Please make sure you press the Make public button your Mapbox styles in Mapbox Studio here and try again:

CleanShot 2024-07-08 at 09 26 13@2x

Simo-DA commented 4 months ago

@JoseLuisGJ thanks a lot for your fast response. I think in my case the style is also not loading, cause the map style is not public.

Unfortunately I can not test it, since I am getting a network error in Mapbox Studio when I try to do so...

Simo-DA commented 4 months ago

I could test it with another account now and setting the style to public solves my problem.

But I also agree with @craftycram that I would rather have two inputs for style url and access token, so that I can just copy and paste from my mapbox account. Manually croping the style id and using the user-name seems much more error-prone end less intuitiv to me. It took me a while to understand, that you actually using your own mapbox token, so I was confused cause I could not find an option to adjust "my mapbox token".

JoseLuisGJ commented 4 months ago

I brought back the Mapbox API access token field to the plugin. With that you can now use your own token and consume private maps styles as you suggested. Managing that one is not trivial, the Mapbox token is not a reactive prop. Now the map component is re-rendered every time a new token is provided.

I'm still trying to improve the validation of the token provided in order to prevent the plugin crash. But for now is quite stable with valid tokens and store the data for the following plugin runs.

CleanShot 2024-07-10 at 13 09 06@2x

craftycram commented 2 months ago

sorry, somehow missed the notification.
yea I did try with public and private styles, somehow both didn't seem to work.
but now that we got a api token field that issue shouldn't be a problem anymore.
thanks for the implementation, gonna let my students know that they can use the plugin again 😌