Hello, tx for having me.
I am not a programmer, and type w 3 fingers, 4 max. site is here https://lovely-travesseiro-f04ec4.netlify.app/ w sequence to help people with brain injuries. in the end, the html report should be emailed, but gives out error 404 on the browser.. and this is what I did thus far:
I followed instructions online, and I installed netilify dev on my laptop .. to test the sendReportEmail,js feature on the end. the report is displaying nicely n the browser, but thecode does not pickup the report html as it should , and there is a 404 error on the browser when i enter email address to forward the report to. The file folder structure is correct.. besides, I got it to send email on laptop.
I added a .env file locally on my laptop with the SENDGRID_API_KEY= key here .. and that is how it got sucessful in sending the email, that i actually received. So I know that part is working.
So friends, the key is right , or I would not revive the email .. right?
email i received has in the source
This is a test of the live function.
from manual test using the laptop terminal—it means I deployed function on Netlify is working perfectly when hit directly.When I went online to teh browser consolen and did this :
fetch(“/.netlify/functions/sendReportEmail”, {
method: “POST”,
headers: {
“Content-Type”: “application/json”
},
body: JSON.stringify({
to: “lalso my oersonal email @gmail.com”,
htmlReport: “
Manual Trigger
This is a quick live test!
”})
})
.then(res => res.json())
.then(console.log)
.catch(console.error);
i got 2 errors instead :
VM379:1 POST https://lovely-travesseiro-f04ec4.netlify.app/.netlify/functions/sendReportEmail 404 (Not Found)
(anonymous) @ VM379:1
SyntaxError: Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON
can someone smarter than me help me figure this out? please?
tx,
John