Cannot access Preview UI

Hi Im trying to send an email with Sendgrid on a form submision and im not making it trying to preview and test my email templates through Preview UI following the documentation (Netlify Email Integration | Netlify Docs) and I just get a dark screen with: Function not found… I dont know what I am doing wrong.

I have tried also making a subdirectory inside emails with the index.html inside it but I still have the same issue.

I would like to point out this part I realiced in the console when doing netlify build:

Context
  production

As I know this preview UI doesnt work in production, but in this case how could I change the build context in my local machine.

Im using Astro as the client framework, and Sendgrid integration for the emails.

I installed the last CLI version, then netlify build and then netlify dev. Then I try to access http://localhost:8888/.netlify/functions/emails

many thanks.

Request from ::1: GET /.netlify/functions/emails
Response with status 404 in 1 ms.
11:02:53 [404] /netlify/functions/emails
11:02:53 [404] /netlify/functions/emails.html
11:02:53 [404] /netlify/functions/emails.htm
11:02:53 [404] /netlify/functions/emails/index.html
11:02:53 [404] /netlify/functions/emails/index.htm

Can you confirm if you’re run netlify link?

This is what im getting running netlify link:

Site already linked to “prismatic-liger-70732f”
Admin url: Netlify App

I believe that issue is coming from Astro. Could you try this on a static site or an empty folder with just the email stuff in it?

the same here, using Next.js

Mind sharing a reproduction like I have asked above?

url: https://warplicensing.net/.netlify/functions/emails
name: warp-licensing

is that enough? Can you access what you need, please?

it’s recognised online. Judging by {"message":"Email previews are not allowed in the undefined environment"} . But locally in dev it says that the function couldn’t be found. I have the latest netlify-cli.

No, I’m trying to ask for a repo that I can test locally. Can you put one together please?

unfortunately I can’t, I can’t share it. Isn’t there any example project?

None that I know of.