I have some code that works perfectly in development and in staging but doesn’t work in production (which is AFAICT identical to staging). The production and staging environments are hosted on Galaxy.
The code is pretty simple. It makes requests using Meteor’s HTTP package (synchronously) to a 3rd party API in order to send an email.
The problem is that it’s timing out after the 29 seconds. I’ve tried the request locally via meteor shell
and it works just fine.
The only thing I can think of is that somehow my production Galaxy container is blocking the execution of the HTTP request. The error appears to be isolated to certain accounts / users.
This is my mailer class:
import { HTTP } from 'meteor/http';
export default class CampaignMailer {
constructor(jobData) {
this.email = jobData.email;
this.nylasToken = jobData.metadata.nylasToken;
}
send() {
return HTTP.call(
'POST',
'https://api.nylas.com/send', {
auth: `${this.nylasToken}:`,
data: {
to: this.email.to,
bcc: this.email.bcc,
body: this.email.html,
subject: this.email.subject,
},
// Always ensure this is less than the timeout on the worker
timeout: 29000, // 29 seconds
}
);
}
}
Even if I start / stop / redeploy the app I still have issues with these specific accounts. Any ideas, anyone? I’ve spent the entire day pulling my hair out on this one!