question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Mapbox with custom mapbox style object - access token not found

See original GitHub issue

Following the plotly mapbox-layers doc, I am trying to change the layout.mapbox.style attribute from ‘light’ (default Light mapbox) to a custom mapbox style object (cf. spec)

Both require an access token, which I have.

When setting the style to ‘light’ the access token is well found, can be tested in the following codepen. But when using a custom style object it seems we lose track of the mapboxAccessToken config attribute. (cf. this codepen).

I also tried to pass the access token as a query parameter as I saw in some mapbox methods we would parse it that way: normalizeTileURL

We could do a PR on the mapbox repository to add the same logic in: normalizeSpriteUrl

but I feel like it’s more a matter of Plotly correctly passing the access token to the mapbox API.

I think we could fix that by adding the access token to the options passed to the Map constructor, here

I’ll test that.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
LoganWlvcommented, Nov 25, 2021

It seems to work, I’ll create a PR

0reactions
LoganWlvcommented, Feb 15, 2022

I tested it again, and could not reproduce the issue. I guess I did a mistake when reading Codepen logs, I’m very sorry for the waste of time, thank you.

I’m closing this issue. (Tested my Codepens & the mapbox_custom-style.json test)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blank or missing map tiles | Help - Mapbox docs
Learn why you may be seeing blank or missing tiles. ... Style ID; Tileset ID. Your access token is invalid; Your account is...
Read more >
mapboxgl api access error : {"message":"Not Found"}
but I'm not able to access that style when calling api. it simply returns with {"message":"Not Found"} I can directly access the api...
Read more >
Mapbox map layers in Python - Plotly
A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/. OpenStreetMap tiles: no token needed¶. Here is a simple map rendered with ...
Read more >
mapbox-gl-js/CHANGELOG.md at main - GitHub
Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL - mapbox-gl-js/CHANGELOG.md at main · mapbox/mapbox-gl-js.
Read more >
Mapbox-gl-js giving `message: Not found` error - Reddit
The access token is just the default public token provided to me by the dashboard. App.tsx import React, { useState } from 'react';...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found