Base64 string different on production than development

Site name: blushbasics.netlify.app
Framework: remix

We’ve created a form on the front-end that accepts a file upload. We’re using Mailjet to send an email with the file as an attachment on the server-side. Attachments are required to be base64 encoded (using fs.readFileSync(file.filepath, "base64") to encode the file).

In development, the attachment works perfectly in the email. In production (on Netlify), I still get an attachment in the email, but it’s broken.

The development base64 string (first line) looks like this:
9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYn

The production base64 string (first line) looks like this:
77+977+977+977+9AEMABgQFBgUEBgYFBgcHBggKEAoKCQkKFA4PDBAXFBgYFxQWFhodJR8aGyMc

Could anyone point me in the right direction on what’s happening on the Netlify side of things not happening on the development side?

Hey @blushbasics,

My answer would depend on how you’re sending the file to the function. Because…

So chances are, in production, the event body is already coming out as base64 encoded.

In the past, there was an issue where the CLI was not encoding the body as base64:

which has since been fixed. But any additional details would let us confirm.

Thanks, @hrishikesh for getting back to me.

Okay, I did see the body is coming out as base64 encoded. I tried working with it but it seems like the file upload still gets corrupted for whatever reason.

While waiting for a response I reached out on the Remix Netlify Discord channel and it appears that they’re looking into it (Discord).