404 error - missing to attach html w user input to email

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

@lifecrane The 404 indicates when it tries to run the function that it doesn’t exist at that URL:

Check your Deploy log
https://docs.netlify.com/site-deploys/overview/#deploy-log

The Deploy summary should give you an idea if your functions were detected:
https://docs.netlify.com/site-deploys/overview/#deploy-summary

This summary indicates how many files have been uploaded to our CDN. It also indicates the status of site headers and redirects included in the deploy. It also shows you how many functions and edge functions were deployed.

Check the Functions tab, make sure the function exists:
https://docs.netlify.com/functions/overview/#manage-your-functions

Once you know the function is running, you can check the Function logs:
https://docs.netlify.com/functions/logs/

my friend:

that I could see, and tbh, your UI is not for beginners.. and I explain why :

Your logs for a project should be easily visible, and have a console of some sorts , so I did install the netlify dev , and since I could not find any useful info ..

I started interacting with AI, when I found that the email is working.. so i suspecte dthat your tech is not picking up the html ..

So I put this into a hello.js on root, adn then called it, and got error

fetch(“/.netlify/functions/hello”) .then(res => res.json()) .then(console.log) .catch(console.error); Promise {} VM104:1 GET https://lovely-travesseiro-f04ec4.netlify.app/.netlify/functions/hello 404 (Not Found) (anonymous) @ VM104:1 SyntaxError: Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON Promise.catch (anonymous) @ VM104:4

so my functions are not working at all, I think …

The Ai confirmed:

Netlify Functions aren’t being deployed, which is why every call to /.netlify/functions/sendReportEmail (or even the dummy hello) returns a 404 and a <!DOCTYPE html> error.

th elog provided have no use for this ..Created site environment variable , but has no useful info ..

[
  {
    "key": "SENDGRID_API_KEY",
    "scopes": [
      "builds",
      "functions",
      "runtime"
    ],
    "values": [
      {
        "value": "****",
        "context": "dev"
      },
      {
        "value": "****************yTCc",
        "context": "branch-deploy"
      },
      {
        "value": "****************yTCc",
        "context": "deploy-preview"
      },
      {
        "value": "****************yTCc",
        "context": "production"
      },
      {
        "value": "****************yTCc",
        "context": "dev-server"
      }
    ],
    "is_secret": true
  }
]

I think the problem is nothing to do with deploy, just w function . Once the tech is sending email correctly , I am no programmer, but .. I think the functions are not working. without complicating the attachment of html to send on email, this simple hello.js inside functions, should be working , right?

exports.handler = async () => {
return {
statusCode: 200,
body: JSON.stringify({ message: “Hello from Netlify!” })
};
};

https://lovely-travesseiro-f04ec4.netlify.app/.netlify/functions/hello

That would be a simple test , that does not work either. At least, that is the way I understand this stuff, but .. I am not pro.

Please don’t address me like this.

It’s not my UI, I do not work for Netlify.
Netlify started as a developer-centric platform, so I’d agree that it’s “not for beginners”.

Again, they aren’t “my logs”, but the logs are easily visible, there is a “console of some sorts”.
Read the information that I provided previously, check the logs that I have pointed to.

I understand that you’re not a developer, and that you’re leveraging AI.
I don’t use AI much myself as the current generation are frequently incorrect/misleading.
Please don’t tell me what “AI says” as I genuinely do not care.
I care only about what your actual UI/logs show, facts matter more than potential AI hallucinations.

Again, it’s not “my tech” as I do not work for Netlify.
I don’t know what you mean by “not picking up the HTML” as HTML has nothing to do with this.

You don’t need the AI to confirm this.
You can use the instructions I provided previously to confirm it yourself directly.

I also strongly suspect they aren’t being detected, as per my previous instructions.
Check the logs, check the UI, see if Netlify is showing it can see the function during the build, and if the function is showing in the UI.

If it hasn’t been detected, (for whatever reason), then everything else is irrelevant.

ok my friend. I understand .. perhaps I will look into the debug crom cli, because the netlify system is very powerful , but not that user friendly for someone part timer like me, without money yet to hire a programmer .

No worries, I have no idea why you would want to debug via the CLI, but if you want to ignore my repeated clear instructions then that’s your choice.

It’s just a bit disingenuous to ignore instructions whilst also claiming things aren’t ‘user friendly’.

Here’s some extra reading regarding your usage of the word ‘friend’:

https://english.stackexchange.com/questions/589928/is-it-considered-rude-or-inappropriate-to-frequently-address-others-as-friend