Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size lim
How can I know which one is too big?
10 Replies
do:
du -sh *
functions for to check file sizesis it the whole functions folder that must be under 1MB ?
that seems pretty large but yea it bundles all of them together + any dependencies into a single function/worker which has to be less then 1 MiB gzip on free
I dont know why my middleware function is so large there is barely 125lines of code there
I also have in /api/email an email function that takes a string of 25lines and it's 444ko I dont get it
probably dependencies/libraries you are using
hmm maybe it's the react import?
that's not it so that's probably the imports inside my route
yeah looks like it's the resend library :/ Argh I loved cloudflare pages, I have my domain there and analytics
you won't get as robust error handling/typing, but what if you try using fetch via their api?
Yeah that’s what I did but sadly it means I can’t send react content anymore
I’m afraid my functions will get higher fast every page takes 60ko maybe I should switch some to use client but I lose SSR
You can send emails in html format, if that's what you want to do. Probably there are lighter packages for that.
also if you're using react email, you can build to plain html, no?
what i did back when i needed formatted email was make placeholders like {{this}} and then manually
.replace(/{{thing}}/, "value")
for me, formatted email is a little annoying and just a tiny amount of html with pretty much plaintext email works nice