-
Notifications
You must be signed in to change notification settings - Fork 534
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
API access token is required to use Mapbox GL #822
Comments
Do you only get this on stackblitz or also in your local dev environment? It seems to me that it could somehow have to do with the module resolution. The code itself is correct... |
@mklopets in local dev env too =( |
you have previously opened issues in this repo – you had code that was at least somewhat working back then – do you get the same issue now when you run that code & setup? |
My code worked well on version 4.6.1. But it stopped on 4.8.2. Example: https://stackblitz.com/edit/react-ts-6xwwgg (in local env on version 4.6.1 everything works well) |
I'm getting the same problem. Just trying to get a map to render after react-map-gl didn't fulfill our needs. |
I also run into this bug on Meteor stack. Both local dev and in Galaxy. Works fine up to and including version 4.6.2. Version 4.7.0-4.8.2, I get this error. Happy to help troubleshoot as best I can. |
I'm getting the same issue going from My working code is here before the upgrade. PS: I tried to debug this further by changing my package.json to link directly to your git commits but due to your TypeScript configuration the |
I am experiencing the same problem with the latest version. I downgraded and it works perfectly.
|
I am having the same issue and the only thing I did was update the package to the latest version :/ Last working version was 6.2 after that every version is failing |
@alex3165 Are you aware of this? |
Same issue here. Did anyone manage to solve this problem? |
Same issue still, keep me posted if there was a fix! Downgrading seemed to work for now. |
I got bitten by this as well, solved it for
The lib does the same, but this seems to work when the lib doesn't. |
Confirming @ndreas's fix works for |
im getting the same error using Vite as bundler. also i had to add this to my vite config:
EDIT: without that fix, vite won't run, and this error appears, |
I've finally managed to fix this issue. I'm also using Vite (Rollup) bundler. This is what worked for me: // somewhere in your app code before using mapbox:
import * as mapboxgl from 'mapbox-gl';
(mapboxgl as any).accessToken = mapboxAccessToken; // vite.config.js
export default defineConfig({
// ...
resolve: {
alias: [
// ...
{
find: /^react-mapbox-gl/,
replacement: 'react-mapbox-gl/lib',
},
],
},
});
|
Unfortunately, this didn't work for me with vite.js on those versions or the latest ones, however I was able to set the token like this:
|
It looks like versions earlier that 7.0 used: v7.0 uses: That change fixed it for me. |
@brianvandenakker I am a bit confused, you're linking to react-map-gl, which I thought was an entirely different library than react-mapbox-gl (this repository), of which the latest version is 5.1.1 ? |
Thanks, @brianvandenakker your fix worked very well for me! |
@brianvandenakker Thanks a lot, the documentation you shared helped me fix it. |
Tell me please. Why do I receive this error:
Error: "An API access token is required to use Mapbox GL. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"
Any other token doesn't work either
Example: https://stackblitz.com/edit/react-ts-fe73xz
The text was updated successfully, but these errors were encountered: