Cannot access public key on page deployed on digitalOcean #140
Replies: 2 comments
-
You should ensure that you pass environment variables correctly during the build of your app since the browser is, of course, unable to use envs. P.S. There is already the 4th version. |
Beta Was this translation helpful? Give feedback.
0 replies
-
inactive |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have deployed a page via gitlab with docker and kubernetes on digitalOcean. The same page is hosted on render.com and there the email works without problems. But when I want to send an email from my page deployed on digitalOcean, I get this error: Uncaught The public key is required. The public key is set in my env-variables. The gitlab pipeline takes the env variables and also I can print out all variables including the public key in my kubernetes pod. All other env-variables are working. Is there any special configuration needed, when sending an email out of the cloud? I am using the version: "@emailjs/browser": "^3.12.1". And I am using the ingress-nginx controller. Thanks for your help. Here is the snippet from my contact-page: ```
const serviceID = process.env.REACT_APP_EMAIL_SERVICE_ID;
const templateID = process.env.REACT_APP_EMAIL_TEMPLATE_ID;
const publicKey = process.env.REACT_APP_EMAIL_PUBLIC_KEY;
console.log(serviceID, templateID, publicKey)
const sendEmail = (e) => {
e.preventDefault();
emailjs.sendForm( serviceID, templateID, form.current, publicKey)
.then((result) => {
console.log(result.text);
console.log("message sended")
form.current.reset()
}, (error) => {
console.log(error.text);
});
}
Beta Was this translation helpful? Give feedback.
All reactions