stripe-go: invalid character '<' looking for beginning of value
Hey,
Some requests are failing with the following error:
invalid character '<' looking for beginning of value
I configured the number of retries to 3. Here’s a timeline of what happened:
On the Stripe dashboard:
12:42:50 POST /charges ends with 200
12:42:52 POST /charges ends with 409
On my logs with LogLevel = 5:
[app logs] 2018-08-01T10:42:53.489Z\",\"caller\":\"logger/logger.go:36\",\"message\":\"Stripe request ended with an error: invalid character '<' looking for beginning of value\",
[stripe-go logs]
"2018/08/01 10:42:53 Retry request https://api.stripe.com/v1/charges 1 time.",
"2018/08/01 10:42:53 Stripe Response: \"{\\\\"id\\\": \\\"ch_*\\\",\
"2018/08/01 10:42:53 Completed in 2.784733977s",
"2018/08/01 10:42:52 Request failed with error: <nil>. Response: &{409....
"2018/08/01 10:42:52 Requesting POST api.stripe.com/v1/charges"
"2018/08/01 10:42:50 Requesting POST api.stripe.com/v1/charges"
One of the two requests ended with a 409 and was retried and failed with the error in the title. As it does not appear on the dashboard, it seems it did not reach your servers.
AFAIK, it should have been retried.
Similar but maybe not related to #528
go version: 1.10.1 stripe-go: 35.1.0
Thanks!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 20 (11 by maintainers)
Commits related to this issue
- Bug fix + various code/logging improvements to retry code This one is a variety of improvements to the retry code: * Fixed one bug whereby for a failed request, we were not reading the entire resp... — committed to stripe/stripe-go by brandur 6 years ago
- Bug fix + various code/logging improvements to retry code This one is a variety of improvements to the retry code: * Fixed one bug whereby for a failed request, we were not reading the entire resp... — committed to stripe/stripe-go by brandur 6 years ago
- Set request body before every retry This patch changes the interfaces of `NewRequest` and `Do` around a little so that we can set a new request body with every request. In the era of HTTP (1), it wa... — committed to stripe/stripe-go by brandur 6 years ago
- Set request body before every retry This patch changes the interfaces of `NewRequest` and `Do` around a little so that we can set a new request body with every request. In the era of HTTP (1), it wa... — committed to stripe/stripe-go by brandur 6 years ago
- Set request body before every retry This patch changes the interfaces of `NewRequest` and `Do` around a little so that we can set a new request body with every request. In the era of HTTP (1), it wa... — committed to stripe/stripe-go by brandur 6 years ago
- Set request body before every retry This patch changes the interfaces of `NewRequest` and `Do` around a little so that we can set a new request body with every request. In the era of HTTP (1), it wa... — committed to stripe/stripe-go by brandur 6 years ago
I suspect that
<is the start of<nil>Okay, I have a fix that seems to work out for review in #646. Thanks again for reporting this and the help in tracking it down! Much appreciated.