Network Error with Maileroo

Hi, I’m trying to send email using Maileroo and always getting Network Error.

I have previously successfully send emails through Resend using ‘Proxy request server side’ but this time it requires multipart/form-data which server side request is not allowed. Not sure what to do next.

Here’s the documentation: Email Sending API | Maileroo

an api request that fails with a network error because of CORS errors (likely this case because proxying with a server eliminated the error) is a strong sign that you are supposed to make requests from your safe backend and not directly from the client app (weweb). this way you also keep the api key for auth secired on your server instead of exposing it directly to the client (even if you check the option to use the proxy any data feom the requestis still exposed to the client, incliding the api key)

1 Like

@dorilama I see. So the best practice is to always make this kind of request from the server. What do you recommend in this case? I’m using Weweb + Supabase. Edge Function maybe? Or do you recommend any ways for low-code founders. Thanks.

2 Likes

if you already use supabase and are ok with some code edge functions are good :+1:

If you don’t feel like spinning up an Edge function for this, since it’s just a REST API request, you can also use the http: RESTful Client | Supabase Docs, it’s fairly simple to set up, compared to scaffolding Edge Functions, you also get less latency in case you’d be fetching some data from the DB, as it all happens on the same server. It’s in PL/SQL and I personally think there is less room for error compared to Edge Functions, if you haven’t done it yet.

1 Like

like a lot of things with code tgere are multiple ways to do the same rhing.
in my opinion using the http extension can have its use when you need to make a query to the db and fetch data to enrich it, you already have rls policies to secure db access and can conditionally fetch the extra data if the initial query is successful.
if you need to imperatively make requests to external services the edge function seems more appropriate because you can leverage an external sdk to ease the request creation, you can easily verify that the request is from an authorized user and eventually rate limit its use.

I agree, at least with the part of leveraging SDKs which is not the case here, but yeah, same same. Depends on the usecase really.

not really same same. supabase secures the data access. if your logic is not tied to data access you probably want to use an edge function to easily express your logic and condition and make sure that only legitimate requests are executed

You can do that in pg too :smile: I had a project where we built a whole game app logic on Postgres functions. Not ideal, but it’s possible :slight_smile: You just have be a little proficient and creative :muscle:

of course you can do it there too. you can also write all your logic on hand optimized assembly, doesn’t mean it’s the fastest development experience XD

there are a lot of other things to handle (errors, retry etc) that are faster to implement in an edge function where you can leverage existing helper libraries.

Yeah, that’s 100% right, and I definitely agree :joy: I just prefer keeping things as frugal as possible. Depends really on the needs of the project

For no-code builders, I ended up setting up webhook to Activepieces as I happen to have an active plan with them. I believe Zapier or Make will also do the job.

This solution can be pricey at scale and the solution suggested above can be much more cost-efficient. But as mine is in early-stage, I’ll go with this one for now and later migrate to code solution down the road.