#PUBLIC_* environmental variables always empty.

2 messages · Page 1 of 1 (latest)

radiant estuary
#

I believe I have followed the docs to the letter.

I have this in my .env file:

PUBLIC_EMAILJS_USER_ID=Blah1
PUBLIC_EMAILJS_SERVICE_ID=Blah2
PUBLIC_EMAILJS_TEMPLATE_ID=Blah3

I use this code to get the values:

const emailjsUserId = import.meta.env.PUBLIC_EMAILJS_USER_ID; const emailjsServiceId = import.meta.env.PUBLIC_EMAILJS_SERVICE_ID; const emailjsTemplateId = import.meta.env.PUBLIC_EMAILJS_TEMPLATE_ID;

However, the variables are always empty. Thus, this code throws the exception:

if (!emailjsUserId || !emailjsServiceId || !emailjsTemplateId) { throw new Error('EmailJS environment variables are not set in code.'); }
I'm clearly missing something obvious.

crisp canyonBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.