Does PlasmicLoader fetch on client or server side?

Plasmic-init and local env:
Does plasmic loader fetch on client side or server side?

I can’t seem to get local env passed to the plasmic-init…

image.png

Either, but all our quickstarts for Next.js and Gatsby assume server side (static). What’s the issue you’re seeing?

the variables are not getting passed to plasmic-init file

I can see in the terminal that the env file is getting loaded

I do get an network error that the token is invalid. And after inspection with Dev tools in the browser id & token are undefined. So I am unsure whats going on.

env.local file is in root, Terminal logs that its been loaded

If you’re using Next, you’ll have to use special variable names to expose them to the browser: https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser

But ideally the browser would not need to fetch anything from Plasmic at all, and all the fetching should’ve been done on the server during SSR/SSG

I don’t want to expose the variables in the browser and I am not

And yes I am using Next

oh do you mean even on the server, you cannot read process.env.PLASMIC_ID? How are you specifying it, and if you just do console.log(process.env.PLASMIC_ID) do you see the right value?

I am specifying it in env.local and yes even as server variable. I did console.log and it just returned undefined

PLASMIC_ID=“…”
PLASMIC_TOKEN=“…”

But with real values ofc

Note: that passing the env variables as browser accessible works. But not the when as server variables