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

HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]" #33

Closed
ediweissmann opened this issue Nov 30, 2021 · 13 comments
Assignees

Comments

@ediweissmann
Copy link

Seeing this from time to time:

org.glassfish.jersey.message.internal.HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]"
org.glassfish.jersey.message.internal.OutboundMessageContext.singleHeader(OutboundMessageContext.java:199)
org.glassfish.jersey.message.internal.OutboundMessageContext.getMediaType(OutboundMessageContext.java:270)
org.glassfish.jersey.client.ClientRequest.ensureMediaType(ClientRequest.java:511)
org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:441)
org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:367)
org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:265)
org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:297)
org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:643)
org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:665)
org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:659)
org.glassfish.jersey.internal.Errors.process(Errors.java:292)
org.glassfish.jersey.internal.Errors.process(Errors.java:274)
org.glassfish.jersey.internal.Errors.process(Errors.java:205)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:659)
org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:642)
org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:445)
org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:346)
com.wildbit.java.postmark.client.HttpClient.execute(HttpClient.java:62)
com.wildbit.java.postmark.client.HttpClientHandler.execute(HttpClientHandler.java:62)
com.wildbit.java.postmark.client.ApiClient.deliverMessage(ApiClient.java:67)
@ibalosh
Copy link
Contributor

ibalosh commented Dec 7, 2021

Thank you for reporting this @ediweissmann

could you share bit more details on how you run the library so we can identify the issue. For example, are you using it in multithreading environment or something similar? If you could share also details about environment you use (Java version, etc) that would help us a lot too.

@ibalosh ibalosh self-assigned this Dec 7, 2021
@ediweissmann
Copy link
Author

Yes to multithreading environment (a java/scala web app), as in there can be multiple threads/requests calling the Postmark API client in parallel.

Is the client not thread-safe, should we take care of the synch access on our end?

java -version
Picked up JAVA_TOOL_OPTIONS: -Xmx100m -Xss512k -Djava.net.preferIPv4Stack=true
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment Corretto-11.0.7.10.1 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.7.10.1 (build 11.0.7+10-LTS, mixed mode)

@ibalosh
Copy link
Contributor

ibalosh commented Dec 7, 2021

Thanks @ediweissmann

client should be thread safe, but that was first to come to my mind related to issue. I will see to dig into this issue this week

@ibalosh
Copy link
Contributor

ibalosh commented Dec 14, 2021

Hi @ediweissmann

we just released version 1.7.6 which should resolve this issue. Let me know if works correctly for you.

Igor

@ibalosh ibalosh closed this as completed Dec 14, 2021
@ediweissmann
Copy link
Author

Thank you, will let you know if it happens after updating.

@aonurozcan
Copy link

Hello @ibalosh

We're using 1.8.0 version and still getting same error. Do you have any idea?

@ibalosh
Copy link
Contributor

ibalosh commented May 3, 2022

Hi @aonurozcan

unfortunately we can't reproduce the issue and haven't received any additional customer support regarding this issue. We will need to investigate it more

@ibalosh
Copy link
Contributor

ibalosh commented May 9, 2022

Hey guys,

in order to resolve this issue I would need as much details as possible from you so that we can reproduce it and fix it. We are not yet sure if the issue is coming from the library or from the API response for this specific case.

things that help

  • exact Java version
  • library version (I am guessing latest)
  • in which period of the day you see the issue
  • any other specific libraries/environment you are using
  • what is the type of sending you do when you see the issue (batch, single emails, attachments, how big email messages, etc)
  • for which endpoints do you see the issue? (sending, templates, outbound messages, link tracking, stats, bounces, etc)
  • do you use windows, linux, mac environment, etc

The more details you share, the easier we will track the issue down

Thanks

@enkuru
Copy link

enkuru commented May 9, 2022

Hey guys,

in order to resolve this issue I would need as much details as possible from you so that we can reproduce it and fix it. We are not yet sure if the issue is coming from the library or from the API response for this specific case.

things that help

  • exact Java version
  • library version (I am guessing latest)
  • in which period of the day you see the issue
  • any other specific libraries/environment you are using
  • what is the type of sending you do when you see the issue (batch, single emails, attachments, how big email messages, etc)
  • for which endpoints do you see the issue? (sending, templates, outbound messages, link tracking, stats, bounces, etc)
  • do you use windows, linux, mac environment, etc

The more details you share, the easier we will track the issue down

Thanks

java version: java-11-amazon-corretto
library version: 1.8.0
in which period of the day you see the issue: it is randomly, we have simulated same failed request and it does successfully sent email
any other specific libraries/environment you are using: spring boot 2.6.6
what is the type of sending you do when you see the issue: single emails with attachment
for which endpoints do you see the issue?: sending mail
do you use windows, linux, mac environment: we are using AWS Beanstalk with Amazon Linux 2/3.2.14

@ibalosh
Copy link
Contributor

ibalosh commented May 9, 2022

@enkuru could you also share how big is the email you are sending, body + attachment?

@enkuru
Copy link

enkuru commented May 9, 2022

@ibalosh sorry I have checked we don't send attachment, only template. So there is only body with 15 KB

@ibalosh
Copy link
Contributor

ibalosh commented May 9, 2022

np, @enkuru do you see this only when sending with templates, or you can see it on some other endpoints too?

@enkuru
Copy link

enkuru commented Jun 21, 2022

Hi, we saw it only sending with templates

@ibalosh ibalosh closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants