MailChimp.Net
MailChimp.Net copied to clipboard
Campaigns.UpdateAsync fails due to ExpectContinue
Today we started running into an issue where a call to Campaigns.UpdateAsync fails (the thread times out) because of the Expect header.
The MailChimpHttpClient class sets this header on every PATCH request. I was only able to work around it by removing this header inside the SendAsync method. The other .NET options to disable it didn't work since it was explicitly set on sending the message within this class.
Is this still needed? If so, can there be an option to disable it? I'm happy to submit a pull request, but I'm unsure what approach would best fit the library.
@lynx44 Do you mean you modified a local copy of the MailChimp.Net library? Or is there another way?
I've just run into this issue on a production service and need to resolve this quickly..
Just want to mention that I am experiencing the same problem with every PATCH request to the Mailchimp API. Every PATCH request is unsuccessful (timeout). When I manually switch the ExpectContinue to false the request is successful. If I leave the header null the request times out.
I am experiencing the exact same issue with patch request, returning timeout. I guess making it configurable would be a good option.
Do we have any good alternative, since production is down?
@lynx44 Do you mean you modified a local copy of the MailChimp.Net library? Or is there another way?
I've just run into this issue on a production service and need to resolve this quickly..
Yes, that is correct.
My changes can be found in this fork.
I packed and deployed a prerelease version to a local filesystem repository with these commands:
nuget pack MailChimp.Net.nuspec
nuget add MailChimp.Net.V3.5.3.2.1-pnwte.nupkg -source C:\nugetpackages
Add your local package repository to the package sources in VS. If needed, replace the the .nupkg file with your package name, which is based on the version specified in the nuspec file. Click the "show prerelease" checkbox in the nuget package explorer, and select your local repo from the drop down.
Also note that I removed support to .NET 4.5 since it's unsupported in VS 2022, and I didn't need it for my project.
@lynx44 Do you mean you modified a local copy of the MailChimp.Net library? Or is there another way? I've just run into this issue on a production service and need to resolve this quickly..
Yes, that is correct.
My changes can be found in this fork.
I packed and deployed a prerelease version to a local filesystem repository with these commands:
nuget pack MailChimp.Net.nuspec nuget add MailChimp.Net.V3.5.3.2.1-pnwte.nupkg -source C:\nugetpackages
Add your local package repository to the package sources in VS. If needed, replace the the .nupkg file with your package name, which is based on the version specified in the nuspec file. Click the "show prerelease" checkbox in the nuget package explorer, and select your local repo from the drop down.
Also note that I removed support to .NET 4.5 since it's unsupported in VS 2022, and I didn't need it for my project.
Thanks for this
This fix worked for me but I am still restricted with working in .NET 452, any chance this framework could be left in there for when this gets added for the next release please?
Would anyone know if and when this fix will applied into a release NuGet package by any chance?
Stale issue message
I would like to reopen this issue. I started to face the same problem running mailChimpManager.Campaigns.UpdateAsync()
. Digging into sources helped me to understand that the issue is due to this line https://github.com/brandonseydel/MailChimp.Net/blob/603ad4467902dbddefadd82b779bcca5854b3eaf/MailChimp.Net/Core/MailChimpHttpClient.cs#L175
if (method.Method == "PATCH")
{
request.Headers.ExpectContinue = true;
}
if I remove it, everything works just fine.
I tried it with postman and same result - without Expect: 100-continue
header API call works fine:
and with it, it hangs:
I don't use any other PATCH
method from the API but I can see there is a lot of them in the code. So I can't really submit a patch to remove this code - and clearly it was working! Looking at the campaigns logs, I can see that last successful email was sent on June 22nd, and the next one of Jul 12th was NOT sent. Which correlates well with the date provided by original posting. And I send using API call only.
I was able to "fix" this issue, by going back to a version 4.2.1
If I debug the code, I can confirm that the ExpectContinue
options should not be set - at least not when updating campaigns.