This is for a Rails app: I'm using a webhook to send out emails to users based on specific stripe events (I'm using Pete Keen's webhook method). Question: Should I fire these emails in the background with a delayed job?
zrail
yes
hey that's my book!
:)
you should use something like sidekiq or delayed job
mahmoudimus has quit
mattq
Hi zrail: Yes, I am trying delayed job (example: StripeEventMailer.delay.charge_failed(charge)), but the mailers are not getting sent for some reason
zrail: delayed job works for some of my other emails. But has not worked for anything that I'm trying to fire from stripe_events_controller
zrail
oh weird
mattq
Does it lose access to the API or something?
zrail
and it's just the mailers that aren't working? the rest of the actions work?
mattq
Yes
zrail
are there errors?
or does it just not do anything
mattq
I'm not sure where/how I would check these errors. But basically not doing anything
Maybe I could check heroku logs?
zrail
yes
:)
webby_ has quit
kamalfariz joined the channel
mattq
zrail: Ok, no "Error" but do get "Warning: Can't verify CSRF token authenticity". That has to be the issue
i'm not sure why the sample app is working without that. that's really weird.
mattq
Cool. I will give it a shot and let you know how it goes (just so you'll know in case someone else asks). This looks like it will fix it. Thanks for your help as always.
zrail
you're welcome!
BentleyAtBellhop has quit
mahmoudimus joined the channel
Guest58591 joined the channel
Guest58591 has quit
Dededede4 has quit
alsobrsp__ has quit
derferman has quit
mattq
Hi zrail. Are you available?
zrail
hi mattq
sure, what's up
dlanger has left the channel
mattq
I added the skip_before_filter to stripe_events_controller. That seems to have solved the CSRF token issue
Now Im getting Error R12 (exit timeout)
zrail
hmmmmmmm
could you put your stripe_events_controller.rb in a gist for me?
ok, so where you say "tested" is that what's blowing up?
HairAndBeardGuy has quit
mattq: are the R12s coming from the worker or the web process
mattq
Not sure: says "At least one process failed to exit within 10 seconds of SIGTERM"
zrail
what's the whole log line
mattq
2014-05-29T21:41:55.894363+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=mycfi.herokuapp.com request_id=10d7b612-d25e-405f-80cd-46674a09d36d fwd="208.191.153.66" dyno=web.1 connect=2ms service=7ms status=200 bytes=317 2014-05-29T21:41:56.313885+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM 2014-05-29T21:41:56.314109+00:00 heroku[web.1]: Stopping rema
zrail
that's for the favicon.ico though
are the POSTs to /stripe_events working?
mattq
Yes. They seem to be
zrail
still no mail though
?
mattq
Yes. No mail
2014-05-29T21:42:37.839075+00:00 app[web.1]: Started POST "/stripe_events.json" for 54.241.31.99 at 2014-05-29 21:42:37 +0000 2014-05-29T21:42:37.934761+00:00 app[web.1]: Completed 200 OK in 84ms (Views: 58.7ms | ActiveRecord: 13.7ms) 2014-05-29T21:42:37.850433+00:00 app[web.1]: Processing by StripeEventsController#create as JSON
what happens if you run those mailers inside StripeEventsController? just do thing().deliver instead of delay.thing()
mattq
They work just fine
zrail
well, that's annoying
mattq
zrail: Yeah. And I'm ok with leaving it that way. Just thought it would be prudent to do DJ
zrail
well, there's one thing
it's weird, though. it should be working.
what if you pass the ID through to the mailer instead of the whole object?
so, for example, StripeEventMailer#customer_subscription_trial_will_end(subscription.id)
and then look it up in the mailer method
i wonder if DJ isn't serializing the stripe objects correctly
mattq
Maybe so. I can try that and let you know later this evening or tomorrow
zrail: Do you think it's important that I send these mailers in the background?
zrail
it's not super critical, but sometimes email servers take awhile to respond and there's not much you can do about it
and then your stripe handler will time out and stripe will try to call you again
HairAndBeardGuy has quit
mattq: if i were you i would work on higher priority stuff and come back to this when you have some time
mattq
Yeah. I'm just wondering how the app would get slowed down b/c I wouldn't really have anything waiting for these mailers, you know?
agreed. Thanks so much for your time!
HairAndBeardGuy joined the channel
zrail
no problem!
HairAndBeardGuy has quit
mattq has quit
HairAndBeardGuy joined the channel
mikejestes has quit
kavinder joined the channel
mikejestes joined the channel
mikejestes has quit
slatri joined the channel
slatri
Hi I need some help I have set up stripe on my website I was able to put through a tranaction but it doesnt show up in my stripe dashboard
this is the transaction number ch_1047rq2WwnvAKdrRpQIrserC
han_shot_first joined the channel
darius93 has quit
darius93 joined the channel
am getting a wrong token error I have changed it and tried test mode and still an error
I have screen shots
HairAndBeardGuy_ joined the channel
HairAndBeardGuy has quit
HairAndBeardGuy joined the channel
markin
slatri, don't have access to the transaction numbers cause I'm not a Stripe employee, but I may be able to help with that token error
mahmoudimus has quit
slatri
Thank you Markin
markin
do you have the full error message and the line that's causing it?
HairAndBeardGuy_ has quit
HairAndBeardGuy_ joined the channel
HairAndBeardGuy has quit
kavinder has quit
slatri
in test mode using 424242... as the card and a valid cvv and exp Invalid id:: tok_1047sC2WwnvAKdrREN24ZcQE. The publishable key used to crate this token is from a different account.this is all i get
markin
how do you create that token?
rdymac has quit
if you generate a token with a test publishable key, you can only charge against it if you use your test secret key
slatri
using the provided test secret key
i am
rdymac joined the channel
markin
slatri: okay, lets work through this. If you check out this gist there are two curl commands
fill in your test secret key in the first one and run it that should return a token which you can enter into the second one