I mean, from console logging, I can see that the function is actually executed on the client, not the server, so
is not really available. Is there any other option to pass that variable?
@mauz. I could be wrong, but I believe you can prefix env vars with PUBLIC, or some keyword that allows it to be available for the client
I would check the official doc on this, I forget it off the top of my head
Payload will automatically supply any present env variables that are prefixed with PAYLOAD_PUBLIC_ directly to the Admin panel. For example, if you've got the following environment variable: PAYLOAD_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXX This key will automatically be made available to the Payload bundle and can be referenced in your Admin component code as process.env.PAYLOAD_PUBLIC_STRIPE_PUBLISHABLE_KEY.
Thanks a lot!