How do I download a PDF from a URL to attach to a mailgun email?

Theo Lemay : humm, so the only problem is that it seems like the pdf file is corrupted.

const axios = require('axios');
const fs = require('fs');

const url = params.pdf;

const response = await axios({
    url,
    method: 'GET',
    responseType: 'stream'
  })

await fs.writeFileSync("/tmp/file.pdf", response.data);

Seems to have the same “step was still trying to run” error