-
Notifications
You must be signed in to change notification settings - Fork 61
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
Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'accessToken') #89
Comments
It seems like the object that should have the accessToken property is undefined at the time the init2 function is called. The error is likely due to the Mapbox GL instance not being initialized before the init2 function attempts to set the accessToken. Has anyone using this software run into this issue? |
Linking issue #84 (comment) in here |
@zachsa999 do you have the same error if you use dynamic public env? (https://kit.svelte.dev/docs/modules#$env-dynamic-public) e.g. <script>
import { env } from "$env/dynamic/public";
// etc ...
</script>
<Map accessToken={env.PUBLIC_MAPBOX_KEY} />
<!-- etc... --> EDIT: Oh sorry misread that - I thought your environment variable was undefined! |
I remember using mapbox with nuxt that it does not play well with SSR (webgl in general I think) - I wonder if yours is trying to render on the server first for some reason? I wonder if you try disabling SSR? ( Alternatively it looks like there was a similar issue in the way back about installing as a dependency when you should install as a dev dependency (changes the way vite bundles it I think): #10 |
@zachsa999 what was the solution? |
I have an error that triggers every page reload. I have the most simplified version of the software set up
When I comment out the component it works, as in, the page loads.
The text was updated successfully, but these errors were encountered: