Why am I getting an error saying a file doesn't exist when I try to email a base64 of a PDF saved to the /tmp directory?

This topic was automatically generated from Slack. You can find the original thread here.

Hello, I’m attempting to save a base64 of a pdf to the /tmp directory to use in a later step (because the base64 is large and returning it directly was throwing an error)

It appears that I’m saving the file to the tmp directory fine, as I can list it, but when I attempt to email it to myself (just to check it out) I get an error saying it doesn’t exist.

Am I doing something wrong?

I got it. needed to be /tmp/filename – PI helped me out

You should check out the File Stores as well.

The /tmp filesystem will be lost between executions if the workflow “goes cold” or another workflow needs to spin up to meet traffic demands.

The File Stores persist between executions, plus you can download files from the PD dashboard.

nice. I’ll check that out. in this case, I’m dealing with large base64s to send to docusign. I don’t need to keep the docs around, just need to move them through the workflow so I can make the api call. /tmp seems to be a good fit for that but I hear on the workflow going cold.

do filestores have unlimited storage or do they purge occasionally? Or would I need to cleanup old files that have been passed off to docusign manually in the workflow?

Nope, no storage limits as of now: File Stores - Pipedream

You can manually clean up files if you’d like there’s a whole JS / Python integration into code steps

sweet thanks. I actually need a URL for another workflow so I can drop a file in airtable so this may be a great solution.

worked like a charm. Looks like pipedream stores them in an s3 bucket, which is great. I don’t have to mess with AWS to get a link to my files. Thanks Dylan

Nice :slightly_smiling_face: yup exactly it’s a nice abstraction on top of S3 with some helpers you can use in your code steps. Big fan

Any chance you have any insight into doing something like the following:

I’m sending some 1 off emails (not a lot) via a company gmail. This is great, because they then show up in our gmail sent folder and we can search them. But rather than sending them plain text, I’d love to clean them up a little.

What I’ve been doing is using https://jsx.email/ locally to build the email template and render it to string. Then I paste that into a code step and populate the dynamic variables and return that. Then use that string for html in the gmail step.

I don’t see a way that I can import the jsx-email library and use a NodeJS codestep to render the email html string for me inside pipedream. Is that correct or am I missing something?

Mainly cause it’s typescript and jsx email is trying to build a .jsx file, which pipedream doesn’t really have

Yea exactly, the problem is that for React/Typescript you’d need to use a bundler like webpack/rollup/vite, etc to convert your tsx|jsx into regular JS that Node.js can interpret.

Node.js by default can’t interpret React.

You could use an email template service like Postmark instead, where you define the template in their UI, and just pass JSON data that populates the variables. They take care of rendering and delivery. Then you can BCC your email and use a Gmail filter to put them in a special folder?

right right right. the bundler step. I try and write so little react I always forget about having to compile react to JS.

Good work around idea with Postmark. At this point, for as many templates as I want using jsx-email and rendering them to html strings locally and copying that into pipedream isn’t bad, but for the future if I get a bunch going I’ll look at that.

thanks!

Yea it’s a pain. You could potentially use the Pipedream REST API to create a workflow on demand per template

True. I’ve been playing with https://www.val.town/ a bunch, and it’ll run jsx. So you could hit an endpoint there and have val.town do the jsx rendering and send it back to pipedream…that might be something I mess with

Nice, that’s a really interesting way to handle it, cross PaaS