Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.GetStoredMessage fails with wrong URL message #58

Closed
fiatjaf opened this issue Jul 31, 2016 · 4 comments
Closed

.GetStoredMessage fails with wrong URL message #58

fiatjaf opened this issue Jul 31, 2016 · 4 comments
Assignees
Labels

Comments

@fiatjaf
Copy link
Contributor

fiatjaf commented Jul 31, 2016

// from a webhook handler
url := r.PostFormValue("message-url")
urlp := strings.Split(url, "/")
err := mailgun.Client.GetStoredMessage(urlp[len(urlp)-1])

Generates an error that reads as

UnexpectedResponseError
URL=https://api.mailgun.net/v2/domains/mydomain.com/messages/eyJwIjpmYWxzZSaWFwiayZDgxNzc0LWJaWFlMzItNGYS1hM2E2LTc4NzUwYWRhZjMaWF3OCIsInMiOiJkYzRjZmIiwiYyI6InNhaWFkIn0=
ExpectedOneOf=[]int{200, 202, 204}
Got=400
Error: {"message":"Please use URLs as they are given in events/webhooks"}

While the value of url was https://si.api.mailgun.net/v3/domains/mydomain.com/messages/eyJwIjpmYWxzZSaWFwiayZDgxNzc0LWJaWFlMzItNGYS1hM2E2LTc4NzUwYWRhZjMaWF3OCIsInMiOiJkYzRjZmIiwiYyI6InNhaWFkIn0=.

@mbanzon mbanzon added the bug label Aug 8, 2016
@mbanzon mbanzon added this to the API v3 / v1.0.0 milestone Aug 8, 2016
@mbanzon
Copy link
Collaborator

mbanzon commented Aug 15, 2016

@fiatjaf this should be fixed in the APIv3 branch.

@mbanzon mbanzon self-assigned this Aug 15, 2016
@fiatjaf
Copy link
Contributor Author

fiatjaf commented Aug 15, 2016

@mbanzon is that branch completely usable? How is the Mailgun support for API v3? How can I get information about this?

(I'm afraid of migrating because things can just stop working, like this same issue, which appeared suddenly and unexpectedly on my production code.)

@mbanzon
Copy link
Collaborator

mbanzon commented Aug 15, 2016

@fiatjaf the tests run without any problems. Mailgun have migrated everything to API v3 - v2 is legacy now. As you see in your original description the "v2" is returning URLs for "v3" - that alone should be a good indicator that you should migrate asap.

If you have any tests you can run to verify integrity that would be awesome - I wouldn't recommend dumping the APIv3-branch right into production code. This should wait it is merged into master - at that point I've been running the code in production for some time (it is running now - no problems so far - afaik the new branch is more stable).

@mbanzon
Copy link
Collaborator

mbanzon commented Aug 16, 2016

I'm going to merge the branch into master shortly.

@mbanzon mbanzon closed this as completed Aug 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants