-
Notifications
You must be signed in to change notification settings - Fork 38
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
Unable to parse SendGrid Example Default or Example Raw payloads - "Duplicate field in section" error #400
Comments
This issue has ben discussed here, here, here and here. To summarize: you are using a payload in MIME format which StrongGrid does not support. The two samples that SendGrid provides on the page you linked are both in MIME format and therefore cannot be used with StrongGrid. Feel free to use the "EmailFromSendGrid.txt" sample I provided back in 2017 here. When you are ready to parse actual webhooks from SendGrid, MAKE SURE that you didn't configure SendGrid to send you the "raw" format. In other words, make sure the "POST the raw, full MIME message" setting is NOT checked like in this example: |
This is the problem I'm having, I've tried posting form data (Using postman, see the error and screenshot above the SG sample), the additional options checkbox is definitely off and I'm still getting errors raised when the endpoint is called by SendGrid themselves. |
In your original comment you said
I hope I was clear that the samples are the cause for this exception. You cannot use those samples because they are in raw MIME format which cannot be parsed. That's the reason I provided an alternate sample. Did you try it? Now you are saying that you are getting this same exception when trying to parse a live webhook posted by SendGrid despite the fact that "Post the raw, full MIME message" option is unchecked??? This sounds really strange. I have never witnessed this particular exception that wasn't caused by the raw format. Did you look at the data posted by SendGrid? Does it seem to be in MIME format? If so, you need to let SendGrid know that they are sending you data in raw MIME format despite your configuration. If not, can you provide the data to help me reproduce the problem and investigate further? |
If you visually inspect the data coming from SendGrid, here are a few pointers to help you determine if it's in the desired format:
|
Did you get to the bottom of why you are getting webhook data in MIME format despite configuring your SendGrid data for structured data? |
According to SendGrid, the option was enabled for a short period then disabled - most likely one of our other developers trying different options. It didn't resolve the issue |
Ok, good to know that there's a delay between turning off the option and when it takes effect. Thanks for the info. By the way, my offer still stands: if you give me a copy of the payload causing problem, I'll be happy to investigate and attempt to reproduce the problem. |
@Saldash are you still interested in researching this issue? I need a copy of your payload to investigate further. Otherwise, let me know and I'll close this issue. |
@Saldash I haven't heard back from you in a while so I'll go ahead and close this issue but I'll be happy to reopen it and continue the investigation if you provide additional info. |
I'm trying to integrate SendGrid inbound parsing into my .Net Core 3.1 web app but I'm unable to get the request body to work.
This line of my code:
var inboundEmail = await parser.ParseInboundEmailWebhookAsync(Request.Body);
constantly fails with the exception "Duplicate field in section" when using either of the example payloads shown here;
https://docs.sendgrid.com/for-developers/parsing-email/setting-up-the-inbound-parse-webhook
I'm using version 0.82.0 of the StrongGrid nuget package.
If I remove what appear to be the duplicate fields from the "headers" section I just get an "Unexpected end of stream", even when adjusting the string length in the payload.
How do I get this to work because I don't know if this is an error with StrongGrid and/or the examples provided by SendGrid in their documentation can be trusted.
For example, the first line, should "Date" not be "Data"?
Is it valid to have multiple "Received" fields?
I'm using Postman to test this locally with the body of the request set to raw and the example below pasted as the body.
I have also tried setting the body to use form-data and setting the fields manually by copying out the data from each, but this results in a new error - "Value cannot be null. parameter ('source')" - here's the screenshot;
The text was updated successfully, but these errors were encountered: