Note that there are some explanatory texts on larger screens.

plurals
  1. POMeteor/Stripe: Receiving XMLHttpRequest cannot load error when attempting to post data to server side route in Meteor
    primarykey
    data
    text
    <p>A few obvious items:</p> <p>I'm using Meteor Router. I've installed the Email package via Meteorite. </p> <hr> <p>Here's what I'm attempting to do:</p> <ol> <li>When a user signs up, I have Stripe setup to create a customer on their end (working).</li> <li>When that customer is created, Stripe creates an event and via webhooks, shares the data for that event with me by sending post data to <a href="http://myapp.meteor.com/stripe" rel="nofollow">http://myapp.meteor.com/stripe</a>. </li> <li>When the post data is received, my application extracts the email address for the customer and triggers a Meteor method which sends an email to that address. </li> </ol> <p>The problem I'm having is that on the first attempt (i.e. when the original event occurs), I receive a 503 error in Stripe. However, if I fire the request again from within Stripe, Meteor accepts it and sends the email just fine. Why would it work the second time (and subsequent times after that), but not the first. Here is my current code: </p> <pre><code>if(Meteor.isServer) { Meteor.startup(function () { process.env.MAIL_URL = /* OBSCURED */; }); Meteor.methods({ sendEmail: function(address, subject, text) { Email.send({ to: address, from: "test@myapp.com", /* OBSCURED ADDRESS */ subject: subject, text: text }); } }); Meteor.Router.add( '/stripe', 'POST', function() { // Grab Post Data post = this.request.body; // Test Type of Post type = post.type customerEmail = post.data.object.email; var email = [customerEmail, "Welcome to My App!", type]; Meteor.apply("sendEmail", email); return [200, "Success"]; }); } </code></pre> <p>What I have noticed is that when the Stripe request is sent, I see the following in my console: </p> <pre><code>XMLHttpRequest cannot load https://ddp--0675-[myapp].meteor.com/sockjs/903/1szdgor_/xhr. Origin http://[myapp].meteor.com is not allowed by Access-Control-Allow-Origin. </code></pre> <p>What am I missing here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload