Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when getting attachments directly from AWS public URL #247

Open
majethiyanirav opened this issue Sep 23, 2019 · 0 comments
Open

Error when getting attachments directly from AWS public URL #247

majethiyanirav opened this issue Sep 23, 2019 · 0 comments

Comments

@majethiyanirav
Copy link

I'm getting Error: BAD_REQUEST when trying to take PDF file directly from public URL of an AWS.

Below is the code :

let file = await request(CERT_PUBLIC_URL + data.imgPath);
where CERT_PUBLIC_URL is the url from AWS and data.imgPath is the file name from server

Below is the code to send an email

var mailOptions = {
from: from,
to: to,
subject: subject,
html: htmlToSend,
attachment: file
};

      mailgun.messages().send(mailOptions, (error, info) => {
        if (error) {
          logger.error(__filename, 'transporter.sendMail', 'No UUID', 'Error during sending an email', error);
        } else {
          logger.info(__filename, 'transporter.sendMail', 'No UUID', 'Email sent successfully.', info.message);
        }
      });

everything else is working fine.
I also tried to use
let file = await request("https://www.google.ca/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png");
which is working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant