Deploy app on Render with mapbox token

Hi everyone. At the moment I am stuck with deploying a dash app to Render. In a nutshell:
-The app contains among other elements a px.scatter_mapbox
-Locally everything works. In the local environment the token for mapbox is stored in an .env file
-I am deploying the app with the help of dash-tools, where a “render.yaml” file is created


-In this file I added the mapbox key at the end…
-…and in app.py I added
get_token_from_os
-and use “mapbox_token” in the definition of the scatter plot.
update_pxScatter

The app will be deployed by Render and is functional, however the map does not show (except for the legend). Maybe I am not seeing the forest for the trees. Seems, the mapbox key is not properly recognized. Any help/ideas are appreciated. Thx, Peter

hi @pittip66
I would have probably done the same things you did and expected it to work. Maybe Render processes their env variables differently.

Try the Per-service Environment Variables method (points 1 to 3). That should work.

Hi Adam,
Thanks for hinting at the alternative method. Actually that was my first try, unfortunately without success. Funny thing is, that…


…not only the legend of the map is shown. There are also the tools in the top-right-corner on hover. The impression is, that something is there…

…and I got the app running with
mapbox_style=“carto-positron”


But somehow one would like to mapbox styles! Let’s wait and see…

1 Like

SOLVED! Ok, this was tricky…
-As said, I am deploying the app with the help of “dash-tools”, where a “render.yaml” file is created
-“dash-tools” creates the “render.yaml” file with the setting: “region: oregon”
-I changed this setting to “region: frankfurt” (DON’T DO THAT)

But as the RENDER docs say:
The region of a service cannot be changed once it’s created.

Seems this was the root of the problem!