OpenIddict using resource server 401 Error: Requires an authenticated User - openiddict

I'm passing a token with the authorization: bearer {token} header.
The {token} was just issued by the OpenIddict server which is using DataProtection() to create reference tokens.
The resource server is setup like this:
services.AddOpenIddict()
.AddValidation(options => {
options.SetIssuer(authenticationSettings.Issuer);
options.AddAudiences(resourceServerSettings.Name);
options.AddEventHandler<ValidateTokenContext>(builder => builder.UseScopedHandler<ValidateAccessTokenHandler>());
var encryptionCert = certificateSettings.IdentityEncryption.GetCertificate();
var signingCert = certificateSettings.IdentitySigning.GetCertificate();
options.AddEncryptionCertificate(encryptionCert);
options.AddEncryptionKey(new X509SecurityKey(signingCert));
options.UseDataProtection();
options.UseSystemNetHttp();
options.UseAspNetCore();
});
Which is directly picked up from Zirku sample although I'm not sure if I need to use the encryptioncertificate and key, or if just encryptioncertificate should be enough. The encryption certificate and encryption key are shared between the main server that issues the token and the resource server and I've verified that they're identical thumbprints. (same with the signingkey)
I'm getting the following in the logs:
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+InferIssuerFromHost.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+InferIssuerFromHost.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ResolveServerConfiguration.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ResolveServerConfiguration.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ResolveTokenValidationParameters.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ResolveTokenValidationParameters.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidateIdentityModelToken.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidateIdentityModelToken.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.DataProtection.OpenIddictValidationDataProtectionHandlers+Protection+ValidateDataProtectionToken.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.DataProtection.OpenIddictValidationDataProtectionHandlers+Protection+ValidateDataProtectionToken.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+NormalizeScopeClaims.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+NormalizeScopeClaims.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+MapInternalClaims.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+MapInternalClaims.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidatePrincipal.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidatePrincipal.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidatePrincipal.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ValidateTokenContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+Protection+ValidatePrincipal.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateAccessToken.
[2022-11-29 16:16:41] info: OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandler[7]
OpenIddict.Validation.AspNetCore was not authenticated. Failure message: An error occurred while authenticating the current request.
OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandler: Information: OpenIddict.Validation.AspNetCore was not authenticated. Failure message: An error occurred while authenticating the current request.
[2022-11-29 16:16:41] info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveHostChallengeProperties.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveHostChallengeProperties.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachHostChallengeError.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachHostChallengeError.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+AttachDefaultChallengeError.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+AttachDefaultChallengeError.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachHttpResponseCode`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachHttpResponseCode`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+AttachCustomChallengeParameters.
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+AttachCustomChallengeParameters.
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachCacheControlHeader`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachCacheControlHeader`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
[2022-11-29 16:16:41] dbug: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachWwwAuthenticateHeader`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
OpenIddict.Validation.OpenIddictValidationDispatcher: Debug: The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+AttachWwwAuthenticateHeader`1[[OpenIddict.Validation.OpenIddictValidationEvents+ProcessChallengeContext, OpenIddict.Validation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=35a561290d20de2f]].
[2022-11-29 16:16:41] info: OpenIddict.Validation.OpenIddictValidationDispatcher[0]
The response was successfully returned as a challenge response: {
"error": "invalid_token",
"error_description": "The specified token is invalid.",
"error_uri": "https://documentation.openiddict.com/errors/ID2004"
}.
OpenIddict.Validation.OpenIddictValidationDispatcher: Information: The response was successfully returned as a challenge response: {
"error": "invalid_token",
"error_description": "The specified token is invalid.",
"error_uri": "https://documentation.openiddict.com/errors/ID2004"
}.
I can't find anything in there that tells me why it failed or even how to intercept what's throwing it so that I can get any more information and this is with logging set to trace.
Any insight as to what I'm doing wrong?

Related

Spring AMQP (RabbitMQ) Throwing Channel Shutdown Error

I am trying to do channel.basicReject() to requeue message based on some condition by creating an MethodInterceptor ConsumerAdvice and adding it to SMLC factor.setAdviceChain(new ConsumerAdvice()). I also have concurrentConsumer configuration which is set to 10. The moment my reject condition is met I issue basicReject command and it gets redelivered and processed by another consumer. During this redelivery process I get the below error,
2019-11-07 17:34:13.268 ERROR 29385 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
2019-11-07 17:34:13.268 DEBUG 29385 --- [ool-2-thread-13] o.s.a.r.listener.BlockingQueueConsumer : Received shutdown signal for consumer tag=amq.ctag-HUaN71TZUqMfLDR7k6LwGQ
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
at java.lang.Thread.run(Thread.java:748)
My message is not getting lost but I am seeing a bunch of above errors and unable to understand why this is happening. If anyone has any clues please guide me.
Below are the trace logs,
2019-11-08 02:11:31.883 TRACE 8695 --- [askExecutor-138] o.s.a.r.c.CachingConnectionFactory : AMQChannel(amqp://guest#127.0.0.1:5672/,99) channel.getChannelNumber()
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ArgumentUtils : Channel number before triggering redelivery : 99
2019-11-08 02:11:31.883 TRACE 8695 --- [askExecutor-138] o.s.a.r.c.CachingConnectionFactory : AMQChannel(amqp://guest#127.0.0.1:5672/,99) channel.basicReject([2, true])
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ArgumentUtils : ==============================================================================
2019-11-08 02:11:31.883 INFO 8695 --- [askExecutor-138] c.g.s.w.consumer.advice.ConsumerAdvice : Requeue Message attempted, status : true
2019-11-08 02:11:31.884 TRACE 8695 --- [askExecutor-138] o.s.a.r.l.SimpleMessageListenerContainer : Waiting for message from consumer.
2019-11-08 02:11:31.884 TRACE 8695 --- [askExecutor-138] o.s.a.r.listener.BlockingQueueConsumer : Retrieving delivery for Consumer#7783912f: tags=[[amq.ctag-eY7LN-1pSXPX8FKRBgt-ug]], channel=Cached Rabbit Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,99), conn: Proxy#37ffe4f3 Shared Rabbit Connection: SimpleConnection#708dfe10 [delegate=amqp://guest#127.0.0.1:5672/, localPort= 58638], acknowledgeMode=AUTO local queue size=0
2019-11-08 02:11:31.884 DEBUG 8695 --- [askExecutor-138] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.checkShutdown(BlockingQueueConsumer.java:436)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.nextMessage(BlockingQueueConsumer.java:501)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:843)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:832)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:78)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1073)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
... 1 common frames omitted
2019-11-08 02:11:31.884 ERROR 8695 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 2, class-id=60, method-id=90)
You need to show your code and configuration.
It seems like the SMLC has its default configuration to automatically acknowledge messages and this failure is because you already rejected it; why are you interacting with the channel directly?
You can simply throw an exception and the container will reject the message on your behalf.
I don't know if it will helpful for someone.
I had the same error because of invalid input data. But when I added next properties:
"rabbit.listener.acknowledgeMode": "MANUAL",
"rabbit.listener.defaultRequeueRejected": "true",
"rabbit.listener.prefetchCount": "1",
the problem stop to break my program but only had stopping my listener

How do I specify a FIPS endpoint url in a boto3 S3 client configuration?

I am currently attempting to configure my boto3 client to connect using a custom endpoint URL for FIPS. https://aws.amazon.com/compliance/fips/
I have the following code that works with boto3 for EC2.
ec2_client.py
import boto3
from botocore.config import Config
config = Config(
retries = dict(
max_attempts = 1
)
)
boto3.set_stream_logger(name='botocore')
ec2_client = boto3.client(
service_name='ec2',
endpoint_url='https://ec2-fips.us-east-1.amazonaws.com',
config=config
)
ec2_client.describe_regions()
Output:
$ python ec2_client.py
2019-08-22 17:35:55,183 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-08-22 17:35:55,187 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway
2019-08-22 17:35:55,187 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-08-22 17:35:55,189 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-08-22 17:35:55,190 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-08-22 17:35:55,190 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-08-22 17:35:55,191 botocore.hooks [DEBUG] Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-08-22 17:35:55,193 botocore.hooks [DEBUG] Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-08-22 17:35:55,193 botocore.hooks [DEBUG] Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-08-22 17:35:55,194 botocore.hooks [DEBUG] Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-08-22 17:35:55,194 botocore.hooks [DEBUG] Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-08-22 17:35:55,218 botocore.credentials [DEBUG] Looking for credentials via: env
2019-08-22 17:35:55,219 botocore.credentials [DEBUG] Looking for credentials via: assume-role
2019-08-22 17:35:55,219 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2019-08-22 17:35:55,220 botocore.credentials [INFO] Found credentials in shared credentials file: ~/.aws/credentials
2019-08-22 17:35:55,220 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/endpoints.json
2019-08-22 17:35:55,226 botocore.hooks [DEBUG] Event choose-service-name: calling handler <function handle_service_name_alias at 0x1056ae488>
2019-08-22 17:35:55,244 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/ec2/2016-11-15/service-2.json
2019-08-22 17:35:55,275 botocore.hooks [DEBUG] Event creating-client-class.ec2: calling handler <function add_generate_presigned_url at 0x10577de18>
2019-08-22 17:35:55,275 botocore.args [DEBUG] The s3 config key is not a dictionary type, ignoring its value of: None
2019-08-22 17:35:55,280 botocore.endpoint [DEBUG] Setting ec2 timeout as (60, 60)
2019-08-22 17:35:55,281 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/_retry.json
2019-08-22 17:35:55,282 botocore.client [DEBUG] Registering retry handlers for service: ec2
2019-08-22 17:35:55,283 botocore.hooks [DEBUG] Event before-parameter-build.ec2.DescribeRegions: calling handler <bound method ParameterAlias.alias_parameter_in_call of <botocore.handlers.ParameterAlias object at 0x1057e6438>>
2019-08-22 17:35:55,283 botocore.hooks [DEBUG] Event before-parameter-build.ec2.DescribeRegions: calling handler <function generate_idempotent_uuid at 0x1057deea0>
2019-08-22 17:35:55,283 botocore.hooks [DEBUG] Event before-call.ec2.DescribeRegions: calling handler <function inject_api_version_header_if_needed at 0x1057e29d8>
2019-08-22 17:35:55,283 botocore.endpoint [DEBUG] Making request for OperationModel(name=DescribeRegions) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': 'Boto3/1.9.6 Python/3.6.3 Darwin/18.7.0 Botocore/1.12.146'}, 'body': {'Action': 'DescribeRegions', 'Version': '2016-11-15'}, 'url': 'https://ec2-fips.us-east-1.amazonaws.com/', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x106d3a4a8>, 'has_streaming_input': False, 'auth_type': None}}
2019-08-22 17:35:55,283 botocore.hooks [DEBUG] Event request-created.ec2.DescribeRegions: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x106d3a438>>
2019-08-22 17:35:55,284 botocore.hooks [DEBUG] Event choose-signer.ec2.DescribeRegions: calling handler <function set_operation_specific_signer at 0x1057ded90>
2019-08-22 17:35:55,284 botocore.auth [DEBUG] Calculating signature using v4 auth.
2019-08-22 17:35:55,285 botocore.auth [DEBUG] CanonicalRequest:
POST
/
content-type:application/x-www-form-urlencoded; charset=utf-8
host:ec2-fips.us-east-1.amazonaws.com
x-amz-date:20190822T213555Z
x-amz-security-token:__xxx__
content-type;host;x-amz-date;x-amz-security-token
__xxx__
2019-08-22 17:35:55,285 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20190822T213555Z
20190822/us-east-1/ec2/aws4_request
791b3e04eac140d25ccb2c00d0d2489c3bab1cccf619bfa5df7a8d22a5826d7f
2019-08-22 17:35:55,285 botocore.auth [DEBUG] Signature:
__xxx__
2019-08-22 17:35:55,285 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://ec2-fips.us-east-1.amazonaws.com/, headers={'Content-Type': b'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': b'Boto3/1.9.6 Python/3.6.3 Darwin/18.7.0 Botocore/1.12.146', 'X-Amz-Date': b'20190822T213555Z', 'X-Amz-Security-Token': b'__xxx__', 'Authorization': b'AWS4-HMAC-SHA256 Credential=__xxx__/20190822/us-east-1/ec2/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token, Signature=__xxx__', 'Content-Length': '41'}>
2019-08-22 17:35:55,495 botocore.parsers [DEBUG] Response headers: {'Content-Type': 'text/xml;charset=UTF-8', 'Content-Length': '3655', 'vary': 'accept-encoding', 'Date': 'Thu, 22 Aug 2019 21:35:55 GMT', 'Server': 'AmazonEC2'}
2019-08-22 17:35:55,495 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0" encoding="UTF-8"?>\n<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">\n <requestId>1cf5ab2e-a72b-4cb7-bd77-1c9dbe1d89c1</requestId>\n <regionInfo>\n <item>\n <regionName>eu-north-1</regionName>\n <regionEndpoint>ec2.eu-north-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ap-south-1</regionName>\n <regionEndpoint>ec2.ap-south-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>eu-west-3</regionName>\n <regionEndpoint>ec2.eu-west-3.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>eu-west-2</regionName>\n <regionEndpoint>ec2.eu-west-2.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>eu-west-1</regionName>\n <regionEndpoint>ec2.eu-west-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ap-northeast-2</regionName>\n <regionEndpoint>ec2.ap-northeast-2.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ap-northeast-1</regionName>\n <regionEndpoint>ec2.ap-northeast-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>sa-east-1</regionName>\n <regionEndpoint>ec2.sa-east-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ca-central-1</regionName>\n <regionEndpoint>ec2.ca-central-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ap-southeast-1</regionName>\n <regionEndpoint>ec2.ap-southeast-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>ap-southeast-2</regionName>\n <regionEndpoint>ec2.ap-southeast-2.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>eu-central-1</regionName>\n <regionEndpoint>ec2.eu-central-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>us-east-1</regionName>\n <regionEndpoint>ec2.us-east-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>us-east-2</regionName>\n <regionEndpoint>ec2.us-east-2.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>us-west-1</regionName>\n <regionEndpoint>ec2.us-west-1.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n <item>\n <regionName>us-west-2</regionName>\n <regionEndpoint>ec2.us-west-2.amazonaws.com</regionEndpoint>\n <optInStatus>opt-in-not-required</optInStatus>\n </item>\n </regionInfo>\n</DescribeRegionsResponse>'
2019-08-22 17:35:55,497 botocore.hooks [DEBUG] Event needs-retry.ec2.DescribeRegions: calling handler <botocore.retryhandler.RetryHandler object at 0x106d3a588>
2019-08-22 17:35:55,497 botocore.retryhandler [DEBUG] No retry needed.
I have the following code that does not work with boto3 for S3.
s3_client.py
import boto3
from botocore.config import Config
config = Config(
retries = dict(
max_attempts = 1
)
)
boto3.set_stream_logger(name='botocore')
s3_client = boto3.client(
service_name='s3',
endpoint_url='https://s3-fips.us-east-1.amazonaws.com',
config=config
)
s3_client.list_buckets()
Output: https://gist.github.com/brokenthumbs/a2e3f05c877582e92cb4d09cc9f05459
$ python s3_client.py
2019-08-22 17:41:54,834 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-08-22 17:41:54,837 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway
2019-08-22 17:41:54,838 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-08-22 17:41:54,840 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-08-22 17:41:54,840 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-08-22 17:41:54,840 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-08-22 17:41:54,841 botocore.hooks [DEBUG] Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-08-22 17:41:54,843 botocore.hooks [DEBUG] Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-08-22 17:41:54,843 botocore.hooks [DEBUG] Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-08-22 17:41:54,843 botocore.hooks [DEBUG] Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-08-22 17:41:54,843 botocore.hooks [DEBUG] Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-08-22 17:41:54,864 botocore.credentials [DEBUG] Looking for credentials via: env
2019-08-22 17:41:54,865 botocore.credentials [DEBUG] Looking for credentials via: assume-role
2019-08-22 17:41:54,865 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2019-08-22 17:41:54,866 botocore.credentials [INFO] Found credentials in shared credentials file: ~/.aws/credentials
2019-08-22 17:41:54,867 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/endpoints.json
2019-08-22 17:41:54,872 botocore.hooks [DEBUG] Event choose-service-name: calling handler <function handle_service_name_alias at 0x10a268510>
2019-08-22 17:41:54,881 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/s3/2006-03-01/service-2.json
2019-08-22 17:41:54,891 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x10a33b158>
2019-08-22 17:41:54,891 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function lazy_call.<locals>._handler at 0x10a4020d0>
2019-08-22 17:41:54,909 botocore.hooks [DEBUG] Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x10a335ea0>
2019-08-22 17:41:54,909 botocore.args [DEBUG] The s3 config key is not a dictionary type, ignoring its value of: None
2019-08-22 17:41:54,913 botocore.endpoint [DEBUG] Setting s3 timeout as (60, 60)
2019-08-22 17:41:54,915 botocore.loaders [DEBUG] Loading JSON file: /Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/data/_retry.json
2019-08-22 17:41:54,916 botocore.client [DEBUG] Registering retry handlers for service: s3
2019-08-22 17:41:54,917 botocore.client [DEBUG] Using S3 path style addressing.
2019-08-22 17:41:54,918 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListBuckets: calling handler <function validate_bucket_name at 0x10a39a378>
2019-08-22 17:41:54,918 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListBuckets: calling handler <bound method S3RegionRedirector.redirect_from_cache of <botocore.utils.S3RegionRedirector object at 0x10b1b6390>>
2019-08-22 17:41:54,918 botocore.hooks [DEBUG] Event before-parameter-build.s3.ListBuckets: calling handler <function generate_idempotent_uuid at 0x10a397f28>
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event before-call.s3.ListBuckets: calling handler <function add_expect_header at 0x10a39a840>
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event before-call.s3.ListBuckets: calling handler <bound method S3RegionRedirector.set_request_url of <botocore.utils.S3RegionRedirector object at 0x10b1b6390>>
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event before-call.s3.ListBuckets: calling handler <function inject_api_version_header_if_needed at 0x10a39ba60>
2019-08-22 17:41:54,919 botocore.endpoint [DEBUG] Making request for OperationModel(name=ListBuckets) with params: {'url_path': '/', 'query_string': '', 'method': 'GET', 'headers': {'User-Agent': 'Boto3/1.9.6 Python/3.6.3 Darwin/18.7.0 Botocore/1.12.146'}, 'body': b'', 'url': 'https://s3-fips.us-east-1.amazonaws.com/', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x10b0b19e8>, 'has_streaming_input': False, 'auth_type': None, 'signing': {'bucket': None}}}
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event request-created.s3.ListBuckets: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10b0b14e0>>
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event choose-signer.s3.ListBuckets: calling handler <bound method ClientCreator._default_s3_presign_to_sigv2 of <botocore.client.ClientCreator object at 0x109e0c550>>
2019-08-22 17:41:54,919 botocore.hooks [DEBUG] Event choose-signer.s3.ListBuckets: calling handler <function set_operation_specific_signer at 0x10a397e18>
2019-08-22 17:41:54,920 botocore.auth [DEBUG] Calculating signature using v4 auth.
2019-08-22 17:41:54,920 botocore.auth [DEBUG] CanonicalRequest:
GET
/
host:s3-fips.us-east-1.amazonaws.com
x-amz-content-sha256:__xxx__
x-amz-date:20190822T214154Z
x-amz-security-token:__xxx__
host;x-amz-content-sha256;x-amz-date;x-amz-security-token
__xxx__
2019-08-22 17:41:54,935 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20190822T214154Z
20190822/us-east-1/s3/aws4_request
__xxx__
2019-08-22 17:41:54,935 botocore.auth [DEBUG] Signature:
__xxx__
2019-08-22 17:41:54,936 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=GET, url=https://s3-fips.us-east-1.amazonaws.com/, headers={'User-Agent': b'Boto3/1.9.6 Python/3.6.3 Darwin/18.7.0 Botocore/1.12.146', 'X-Amz-Date': b'20190822T214154Z', 'X-Amz-Security-Token': b'__xxx__', 'X-Amz-Content-SHA256': b'__xxx__', 'Authorization': b'AWS4-HMAC-SHA256 Credential=ASIAX6MMDPJ5HINHNPVO/20190822/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=__xxx__'}>
2019-08-22 17:41:54,944 botocore.endpoint [DEBUG] Exception received when sending HTTP request.
Traceback (most recent call last):
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/httpsession.py", line 258, in send
decode_content=False,
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/util/retry.py", line 333, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
conn.connect()
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connection.py", line 284, in connect
conn = self._new_conn()
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x10b1b6ba8>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 17, in <module>
s3_client.list_buckets()
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/client.py", line 648, in _make_api_call
operation_model, request_dict, request_context)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/client.py", line 667, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/endpoint.py", line 137, in _send_request
success_response, exception):
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/endpoint.py", line 231, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__
caught_exception)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__
caught_exception)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__
attempt_number, caught_exception)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/endpoint.py", line 200, in _do_get_response
http_response = self._send(request)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/endpoint.py", line 244, in _send
return self.http_session.send(request)
File "/Users/meme/.pyenv/versions/3.6.3/lib/python3.6/site-packages/botocore/httpsession.py", line 278, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://s3-fips.us-east-1.amazonaws.com/"
What do I need to do differently in order to get the boto3 s3 client to connect to a FIPS endpoint? I see that the documentation states:
Note: These Endpoints can only be used with Virtual Hosted-Style addressing. For example: https://bucket.s3-fips.us-east-2.amazonaws.com. Visit the Amazon S3 Documentation page for more information.
I am unsure how this can be applied to my boto3 s3 client configuration. Any ideas on how I can correct my configuration to use FIPS correctly for s3?
Here's what I found that will address your problem.
Modify your Config object as such:
config = Config(
retries = {'max_attempts': 1},
s3 = {'addressing_style': 'virtual'}
)

Error when using twitter User Stream in Mule ESB

I am running the process where I have the twitter as the streaming inbound endpoint capturing all the user sream or the user events .
I sometime get the below errors
WARN 2014-11-19 11:52:05,716 [Twitter4J Async Dispatcher[0]] org.mule.context.notification.ServerNotificationManager: Notification not enqueued after ServerNotificationManager disposal: PipelineMessageNotification{action=pipeline process start, resourceId=CaptureTweets, serverId=null, timestamp=1416378125716}
WARN 2014-11-19 11:52:05,736 [Twitter4J Async Dispatcher[0]] org.mule.context.notification.ServerNotificationManager: Notification not enqueued after ServerNotificationManager disposal: PipelineMessageNotification{action=pipeline process complete, resourceId=CaptureTweets, serverId=null, timestamp=1416378125736}
ERROR 2014-11-19 11:52:05,736 [Twitter4J Async Dispatcher[0]] org.mule.twitter.adapters.TwitterConnectorConnectionIdentifierAdapter: org.mule.api.MessagingException: Cannot process event as "CaptureTweets" is stopped (org.mule.api.lifecycle.LifecycleException). Message payload is of type: UserEvent
org.apache.commons.lang.UnhandledException: org.mule.api.MessagingException: Cannot process event as "CaptureTweets" is stopped (org.mule.api.lifecycle.LifecycleException). Message payload is of type: UserEvent
at org.mule.twitter.TwitterConnector$SoftCallback.process(TwitterConnector.java:1270)
at org.mule.twitter.TwitterConnector$1.onStatus(TwitterConnector.java:893)
at twitter4j.StatusStreamImpl.onStatus(StatusStreamImpl.java:75)
at twitter4j.StatusStreamBase$1.run(StatusStreamBase.java:114)
at twitter4j.internal.async.ExecuteThread.run(DispatcherImpl.java:116)
Caused by: org.mule.api.MessagingException: Cannot process event as "CaptureTweets" is stopped (org.mule.api.lifecycle.LifecycleException). Message payload is of type: UserEvent
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:32)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:102)
at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:109)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:94)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:50)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:67)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:22)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:66)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:61)
at org.mule.construct.AbstractPipeline$3.process(AbstractPipeline.java:207)
at org.mule.security.oauth.processor.AbstractListeningMessageProcessor.processEvent(AbstractListeningMessageProcessor.java:150)
at org.mule.security.oauth.processor.AbstractListeningMessageProcessor.process(AbstractListeningMessageProcessor.java:76)
at org.mule.twitter.TwitterConnector$SoftCallback.process(TwitterConnector.java:1268)
... 4 more
Caused by: org.mule.api.lifecycle.LifecycleException: Cannot process event as "CaptureTweets" is stopped
at org.mule.construct.AbstractPipeline$ProcessIfPipelineStartedMessageProcessor.handleUnaccepted(AbstractPipeline.java:400)
at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
... 25 more
not sure of the error and need more information on the same.
You need to have <json:object-to-json-transformer> to transform Twitter data
Could you pls check this link to get the idea of connecting Mule with Twitter :- http://www.whishworks.com/blog/integration-with-twitter-using-mule-esb/

How to not lose messages when publishing to RabbitMQ from Mule until the proper "Ack" is received?

I have a synchronized Mule flow which reads messages from a sonic topic and publish to a Rabbit exchange.
I am loosing messages when the Rabbit is brought up/down.
Rabbit exchange is publishing to HA queues.
How can I make sure Mule is not consuming the message until proper "Ack" is received from Rabbit Broker?
Here is the flow.
<jms:connector name="sonicMQConnectorSub" validateConnections="true" connectionFactory-ref="factorySub" doc:name="JMS" clientId="testClient" durable="true" maxRedelivery="-1" >
<reconnect-forever frequency="30000"/>
</jms:connector>
<spring:beans>
<spring:bean id="soniqMQConnectionFactoryBeanSub" name="factorySub" class="progress.message.jclient.ConnectionFactory">
<spring:property name="connectionURLs" value="tcp://server1:7800" />
<spring:property name="defaultUser" value="user" />
<spring:property name="defaultPassword" value="pass" />
</spring:bean>
</spring:beans>
<amqp:connector name="AMQP" validateConnections="true" host="server2" fallbackAddresses="server3" doc:name="AMQP Connector" port="5672" mandatory="true" activeDeclarationsOnly="true">
<reconnect-forever frequency="30000"/>
</amqp:connector>
<flow name="rabbitFlow1" doc:name="rabbitFlow1" processingStrategy="synchronous">
<jms:inbound-endpoint doc:name="JMS" connector-ref="sonicMQConnectorSub" topic="testtopic"/>
<logger message="Message: #[message.payload]" level="INFO" doc:name="Logger"/>
<amqp:outbound-endpoint exchangeName="rabbitExchange" exchangeDurable="true" responseTimeout="10000" connector-ref="AMQP" doc:name="AMQP" exchangeType="fanout"/>
</flow>
Updated 04/22
Here is the exception trace when Mule is connecting to the 2nd broker. This is when I loose a message.
2014-04-22 09:49:29,453 - org.mule.exception.DefaultSystemExceptionStrategy - ERROR -
********************************************************************************
Message : Connection shutdown detected for: AMQP
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Software caused connection abort: recv failed (java.net.SocketException)
java.net.SocketInputStream:-2 (null)
2. connection error; reason: java.net.SocketException: Software caused connection abort: recv failed (com.rabbitmq.client.ShutdownSignalException)
com.rabbitmq.client.impl.AMQConnection:715 (null)
3. Connection shutdown detected for: AMQP (org.mule.transport.ConnectException)
org.mule.transport.amqp.AmqpConnector$1:502 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/ConnectException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
2014-04-22 09:49:29,453 - org.mule.exception.DefaultSystemExceptionStrategy - INFO - Exception caught is a ConnectException, attempting to reconnect...
2014-04-22 09:49:29,454 - org.mule.lifecycle.AbstractLifecycleManager - INFO - Stopping connector: AMQP
2014-04-22 09:49:29,454 - org.mule.lifecycle.AbstractLifecycleManager - INFO - Stopping: 'AMQP.dispatcher.1064499250'. Object is: AmqpMessageDispatcher
2014-04-22 09:49:29,454 - org.mule.lifecycle.AbstractLifecycleManager - INFO - Disposing: 'AMQP.dispatcher.1064499250'. Object is: AmqpMessageDispatcher
2014-04-22 09:49:29,455 - org.mule.transport.amqp.AmqpConnector - ERROR - clean connection shutdown; reason: Attempt to use closed connection
2014-04-22 09:49:29,461 - org.mule.transport.amqp.AmqpConnector - INFO - Connected: AmqpConnector
{
name=AMQP
lifecycle=stop
this=33c5919e
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
2014-04-22 09:49:29,461 - org.mule.transport.amqp.AmqpConnector - INFO - Starting: AmqpConnector
{
name=AMQP
lifecycle=stop
this=33c5919e
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
2014-04-22 09:49:29,461 - org.mule.lifecycle.AbstractLifecycleManager - INFO - Starting connector: AMQP
Updated 04/23 with the Exception received when JMS Transaction is added to AMQP outbound Endpoint:
Message : No active AMQP transaction found for endpoint: DefaultOutboundEndpoint{endpointUri=amqp://rabbitExchange, connector=AmqpConnector
{
name=AMQP
lifecycle=start
this=25ec1ff7
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.rabbitExchange', mep=ONE_WAY, properties={exchangeDurable=true, exchangeType=fanout}, transactionConfig=Transaction {factory=org.mule.transport.jms.JmsTransactionFactory#6491b172, action=ALWAYS_JOIN, timeout=30000}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.transaction.IllegalTransactionStateException: No active AMQP transaction found for endpoint: DefaultOutboundEndpoint{endpointUri=amqp://rabbitExchange, connector=AmqpConnector
{
name=AMQP
lifecycle=start
this=25ec1ff7
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[amqp]
serviceOverrides=<none>
}
, name='endpoint.amqp.rabbitExchange', mep=ONE_WAY, properties= {exchangeDurable=true, exchangeType=fanout}, transactionConfig=Transaction {factory=org.mule.transport.jms.JmsTransactionFactory#6491b172, action=ALWAYS_JOIN, timeout=30000}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}
at org.mule.transport.amqp.AmqpMessageDispatcher.getEventChannel(AmqpMessageDispatcher.java:298)
at org.mule.transport.amqp.AmqpMessageDispatcher.doOutboundAction(AmqpMessageDispatcher.java:152)
at org.mule.transport.amqp.AmqpMessageDispatcher.doDispatch(AmqpMessageDispatcher.java:127)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
2014-04-23 10:52:03,178 - org.mule.transport.jms.JmsTransaction - WARN - Transaction rollback attempted, but no resource bound to org.mule.transport.jms.JmsTransaction#d4ac3d8f-caf6-11e3-bf9a-8b266a026dee [status=STATUS_MARKED_ROLLBACK, key=null, resource=null]
I see two options:
Make the JMS client a durable one and consume testtopic transactionally so if amqp:outbound-endpoint fails, the message will be redelivered.
Wrap the amqp:outbound-endpoint with until-successful to retry the outbound dispatches until the AMQP connector reconnects to RabbitMQ.

WCF Timeout exception on service call

I have a WCF service that is giving the following error on live
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 19/06/2012 10:39:09
Event time (UTC): 19/06/2012 09:39:09
Event ID: 501c1b630958413db7c7f746b0a467f7
Event sequence: 74336
Event occurrence: 742
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/5/ROOT-1-129844753959691296
Trust level: Full
Application Virtual Path: /
Application Path: <private>
Machine name: <private>
Process information:
Process ID: 6112
Process name: w3wp.exe
Account name: IIS APPPOOL\<private>
Exception information:
Exception type: TimeoutException
Exception message: The HTTP request to '<private>/EndPoint.svc' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Request information:
Request URL: http://<private>/
Request path: /
User host address: <private>
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\<private>
Thread information:
Thread ID: 110
Thread account name: IIS APPPOOL\<private>
Is impersonating: False
Stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
Custom event details:
Our site is down and I don't know what to do here. Any ideas are most welcome.
Try increasing the SendTimeout and ReceiveTimeout properties in service/client configurations.
WCF Service , how to increase the timeout?