I’m using the CreateSend API gem, and in my local dev environment I am able to successfully create a draft campaign.
In production (staging), on Heroku, the exact same code instead returns with an error:
310: HTML Content URL Required
I am definitely passing the HTML content URL, as well as all the other required arguments to Campaign.create (I’ve visually verified the fact by logging the variables). Here’s the API call:
cm_campaign_id = CreateSend::Campaign.create client_id, subject, name, from_name, from_email, reply_to, html_url, text_url, list_ids, segment_ids
Furthermore, in local dev the API call returns in less than 3 seconds, whereas on Heroku it times out for 30 seconds and returns that error.
Why is this happening on Heroku?
Because their API requires a second request to your app to happen in the middle of a first ongoing request, I suggest you move the logic off to a worker process: