quarkiverse / quarkus-amazon-services Goto Github PK
View Code? Open in Web Editor NEWQuarkus Amazon Services extensions
License: Apache License 2.0
Quarkus Amazon Services extensions
License: Apache License 2.0
It appears that on quarkus 3 CR2, or perhaps more generally currently localstack is pinned to 2.0.0, which is now the latest version. You pin it to 1.0.3 in your integration tests.
https://github.com/quarkiverse/quarkus-amazon-services/blob/main/integration-tests/src/main/resources/application.properties
When setting quarkus.aws.devservices.localstack.image-name=localstack/localstack:2.0.0
or indeed leaving it blank, a simple test case persisting to dynamodb fails, because localstack hasn't had enough time to boot yet.
When running master with the image pinned to 2.0.0 the integration tests fail for the same reason.
I have opened #640 to demonstrate this.
It's possible this is an upstream issue, but you guys should be aware of it, it left me a little confused.
Hi there,
while using the enhanced client i'm getting this error while executing a native image:
ERROR [io.qua.ama.lam.run.AbstractLambdaPollLoop] (Lambda Thread (NORMAL)) Failed to run lambda (NORMAL): java.lang.IllegalStateException: GraalVM Substitution: Unable to convert Constructor to MethodHandle
at io.quarkus.amazon.dynamodb.enhanced.runtime.BeanTableSchemaSubstitutionImplementation.newObjectSupplierForClass(BeanTableSchemaSubstitutionImplementation.java:24)
at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.newObjectSupplierForClass(BeanTableSchema.java)
at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.createStaticTableSchema(BeanTableSchema.java:189)
at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.create(BeanTableSchema.java:145)
at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.lambda$create$0(BeanTableSchema.java:135)
at [email protected]/java.util.Map.computeIfAbsent(Map.java:1054)
at [email protected]/java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2760)
at software.amazon.awssdk.enhanced.dynamodb.mapper.BeanTableSchema.create(BeanTableSchema.java:135)
at software.amazon.awssdk.enhanced.dynamodb.TableSchema.fromBean(TableSchema.java:84)
at software.amazon.awssdk.enhanced.dynamodb.TableSchema.fromClass(TableSchema.java:128)
at com.deliveries.common.dao.impl.BaseDaoImpl.findById(BaseDaoImpl.java:72)
at com.deliveries.common.dao.impl.BaseDaoImpl.findByIdSync(BaseDaoImpl.java:133)
at com.deliveries.common.dao.impl.BaseDaoImpl_ClientProxy.findByIdSync(Unknown Source)
at com.deliveries.common.services.impl.BaseServiceImpl.findByIdSync(BaseServiceImpl.java:73)
at com.deliveries.common.services.impl.SourceServiceImpl_ClientProxy.findByIdSync(Unknown Source)
at com.deliveries.sanity.SanityCheckLambda.findSource(SanityCheckLambda.java:126)
at com.deliveries.sanity.SanityCheckLambda.isDeliveryValid(SanityCheckLambda.java:62)
at com.deliveries.sanity.SanityCheckLambda.handleRequest(SanityCheckLambda.java:44)
at com.deliveries.sanity.SanityCheckLambda.handleRequest(SanityCheckLambda.java:22)
at io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder$1.processRequest(AmazonLambdaRecorder.java:167)
at io.quarkus.amazon.lambda.runtime.AbstractLambdaPollLoop$1.run(AbstractLambdaPollLoop.java:137)
at [email protected]/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
Caused by: java.lang.NoSuchMethodException: com.deliveries.common.models.parameters.Source.<init>()
at [email protected]/java.lang.Class.getConstructor0(DynamicHub.java:3585)
at [email protected]/java.lang.Class.getConstructor(DynamicHub.java:2271)
at io.quarkus.amazon.dynamodb.enhanced.runtime.BeanTableSchemaSubstitutionImplementation.newObjectSupplierForClass(BeanTableSchemaSubstitutionImplementation.java:21)
... 23 more
An example to one of my models:
@DynamoDbBean
@RegisterForReflection
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Source {
private long id;
private String name;
private long externalId;
@DynamoDbPartitionKey
public long getId() {
return id;
}
public String getName() {
return name;
}
public long getExternalId() {
return externalId;
}
}
Has anyone faced this issue?
Hi! After upgrade quarkus from 2.12.3 to 2.13.1 (with upgrading quarkus-amazon-services
from 1.1.3 to 1.3.0) all ours DynamoDB client failed on real DynamoDB service (on mock server - all still work).
Explicitly we not provide any DynamoDB properties.
DynamoDB client call throws errors like this:
dynamodb-ssl-error.txt
If i set property quarkus.dynamodb.async-client.tls-trust-managers-provider.type
to trust-all
issue fixed, but this not look as solution for production.
Look like this broken by this changes.
com.google.common.base.Predicate
is not consistent with java.util.stream.Stream
interface.
java.util.function.Predicate
should be used instead
Although those two types share the same interface (in most cases) sometimes this one takes over the intended one and it can lead to some very regretful time losses.
As a followup for the ticket #173
would be nice to have an option to automatically run custom "sh" script inside localstack container after startup for dev and test modes.
This could be used to create dynamodb tables, populate some initial data or do whatever else common operations to prepare localstack infrastructure for dev-mode.
Hi,
I brought this topic up in the official quarkus chat already. As it looks like, test container ITs are failing after upgrading from quarkus-2.15.0 to quarkus-2.15.1 with the following exception:
exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / (Service: S3, Status Code: 500, Request ID: 66281TRHYSDR7GOPH0SJPNHDY08CQBYLGOLOPWNGZ8GK9D6EIRB2, Extended Request ID: MzRISOwyjmnupHJ792CT6TKD5UTES5VLJSASFLUJ40GN7CZ8JGIH2T453W5GCM1F37/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp)
software.amazon.awssdk.services.s3.model.S3Exception: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / (Service: S3, Status Code: 500, Request ID: 66281TRHYSDR7GOPH0SJPNHDY08CQBYLGOLOPWNGZ8GK9D6EIRB2, Extended Request ID: MzRISOwyjmnupHJ792CT6TKD5UTES5VLJSASFLUJ40GN7CZ8JGIH2T453W5GCM1F37/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp)
at software.amazon.awssdk.protocols.xml.internal.unmarshall.AwsXmlPredicatedResponseHandler.handleErrorResponse(AwsXmlPredicatedResponseHandler.java:156)
at software.amazon.awssdk.protocols.xml.internal.unmarshall.AwsXmlPredicatedResponseHandler.handleResponse(AwsXmlPredicatedResponseHandler.java:108)
at software.amazon.awssdk.protocols.xml.internal.unmarshall.AwsXmlPredicatedResponseHandler.handle(AwsXmlPredicatedResponseHandler.java:85)
at software.amazon.awssdk.protocols.xml.internal.unmarshall.AwsXmlPredicatedResponseHandler.handle(AwsXmlPredicatedResponseHandler.java:43)
at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler$Crc32ValidationResponseHandler.handle(AwsSyncClientHandler.java:95)
at software.amazon.awssdk.core.internal.handler.BaseClientHandler.lambda$successTransformationResponseHandler$7(BaseClientHandler.java:266)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:40)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:30)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:73)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:78)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:40)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:50)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:36)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:81)
at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:36)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:56)
at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:36)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:48)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:31)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:193)
at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:103)
at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.doExecute(BaseSyncClientHandler.java:171)
at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:82)
at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:179)
at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76)
at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45)
at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56)
at software.amazon.awssdk.services.s3.DefaultS3Client.createBucket(DefaultS3Client.java:1154)
at software.amazon.awssdk.services.s3.S3ClientProducer_ProducerMethod_client_c3e44358d8bba829ee2f6ae63d6f9ef0b4609f3a_ClientProxy.createBucket(Unknown Source)
at com.acme.fallbackimagedownloader.FallbackImageDownloaderLambdaIT.setUp(FallbackImageDownloaderLambdaIT.kt:61)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
at app//io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:997)
at app//io.quarkus.test.junit.QuarkusTestExtension.interceptBeforeEachMethod(QuarkusTestExtension.java:797)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at app//org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:128)
at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeEachMethod(TimeoutExtension.java:78)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at app//org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeMethodInExtensionContext(ClassBasedTestDescriptor.java:520)
at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$synthesizeBeforeEachMethodAdapter$23(ClassBasedTestDescriptor.java:505)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachMethods$3(TestMethodTestDescriptor.java:174)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$6(TestMethodTestDescriptor.java:202)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:202)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachMethods(TestMethodTestDescriptor.java:171)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:134)
at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at app//org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at [email protected]/java.lang.reflect.Method.invoke(Method.java:568)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy2/jdk.proxy2.$Proxy5.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Suppressed: software.amazon.awssdk.core.exception.SdkClientException: Request attempt 1 failure: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / (Service: S3, Status Code: 500, Request ID: JCDDILCMRO2ZEK7N9YC1WHRX4HV50FJAD60SV5FC9GKF76YX7TGZ, Extended Request ID: MzRISOwyjmnupUW8CQTNDIEG0I9ZJXOXFXRCC6S7ZJEZYK29Q7CCXTMQQWJSALDOJ7/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp)
Suppressed: software.amazon.awssdk.core.exception.SdkClientException: Request attempt 2 failure: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / (Service: S3, Status Code: 500, Request ID: CABYZ19OC8IP1DZZSLQBDPGKR9WTL5BWHYJG6GUO9CSLGILPRGZY, Extended Request ID: MzRISOwyjmnup3AKINKD4NRSJRPI7LAT6UMQPHFEKEVJAJLPBQFQ9N19G1DDZLMJ97/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp)
Suppressed: software.amazon.awssdk.core.exception.SdkClientException: Request attempt 3 failure: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT / (Service: S3, Status Code: 500, Request ID: I0U5H1OU1BIJD5VWWGKSO1APDP08BGIWJ8UQWG40TO6U08IZ3QL9, Extended Request ID: MzRISOwyjmnupO4ISFJUCN86BTD11G03822AWWY8MLHF5VYM43AZ0TJM3QQOEQFI07/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp)
The code under test is quite simple:
@ApplicationScoped
class ImageDownloader(
private val s3: S3Client,
@ConfigProperty(name = "bucket.name") val bucketName: String,
@ConfigProperty(name = "dmb.user") val user: String,
@ConfigProperty(name = "dmb.password") val password: String,
) {
fun handleImageEvent(imageEvent: FallbackImageEvent) {
logger.info { "Bucket-Name: $bucketName" }
val key =
"epg/${imageEvent.payload.channel}/${imageEvent.payload.programId}/${imageEvent.payload.fileName}"
if (!isImageDownloaded(key)) {
when (val downloadResult = downloadImage(imageEvent.payload.imageUrl)) {
is EmptySuccess -> {
return
}
is ImageUnavailable -> {
logger.warn { "Image not available: $key" }
}
is DownloadFailed -> throw RuntimeException("Download failed with status ${downloadResult.statusCode} and message ${downloadResult.message}")
is DownloadSuccess ->
s3.putObject(
PutObjectRequest.builder()
.bucket(bucketName)
.key("inbox/$key")
.contentLength(downloadResult.contentLength)
.build(),
RequestBody.fromInputStream(downloadResult.inputStream, downloadResult.contentLength),
)
}
}
}
The build.gradle
file uses the quarkus-bom to fetch the necessary dependencies:
dependencies {
implementation enforcedPlatform("io.quarkus.platform:quarkus-bom:${quarkusVersion}")
implementation enforcedPlatform("io.quarkus.platform:quarkus-amazon-services-bom:${quarkusVersion}")
implementation 'io.quarkus:quarkus-amazon-lambda'
implementation 'io.quarkus:quarkus-kotlin'
implementation 'io.quarkus:quarkus-config-yaml'
implementation 'io.quarkus:quarkus-jackson'
implementation 'io.quarkiverse.loggingjson:quarkus-logging-json:2.0.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.squareup.okhttp3:okhttp'
implementation 'io.quarkiverse.amazonservices:quarkus-amazon-s3'
implementation 'io.quarkiverse.amazonservices:quarkus-amazon-sqs'
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'io.quarkus:quarkus-arc'
implementation 'software.amazon.awssdk:url-connection-client'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.400'
implementation 'io.github.microutils:kotlin-logging:2.1.23'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
testImplementation "io.rest-assured:kotlin-extensions:5.3.0"
testImplementation 'com.willowtreeapps.assertk:assertk-jvm:0.25'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.35.0'
testImplementation 'io.quarkus:quarkus-jacoco'
}
I digged a bit through the change sets of 2.15.1 and the commit that seemed most likely the culprit enforced an update of the aws-sdk lib: quarkusio/quarkus-platform@c778465
When I enforce the previous aws-sdk version with gradle, the tests start working again, even with quarkus-2.15.1.:
configurations.configureEach {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group.equals('software.amazon.awssdk')) {
details.useVersion "2.17.291"
}
}
}
}
Are there any migration steps necessary to make these test container tests green again without providing custom gradle build logic and enforcing a certain aws-sdk version?
We've been using the quarkus-amazon-dynamodb extension and has worked great for us, including native builds. However the netty-handler
library is getting flagged by Veracode as having a MitM vulnerability all the way to the latest versions (https://sca.analysiscenter.veracode.com/vulnerability-database/libraries/netty-handler/java/maven/lid-6250). I tried excluding quarkus-netty
from the build, but it won't compile without it.
It may be valuable to have the RDS artifact software.amazon.awssdk:rds
encapsulated in an extension. I don't foresee most of it getting used in the average use case, however, the dependency does provide the RdsUtilities
class that is used for IAM-based authentication to databases. This client could be used as a stepping stone to implement a credentials provider for RDS database connections.
Hello,
I've been playing around with the Quarkus Amazon DynamoDB quickstart and I've uncovered what looks like a bug when using an asynchronous dynamo client and the dynamodb-enhanced extension.
I've distilled the problem down to the minimum set of changes to highlight the problem. The diff of my changes is:
Index: amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitResource.java
===================================================================
diff --git a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitResource.java b/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitResource.java
deleted file mode 100644
--- a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitResource.java (revision 20053c0a201388e02a45120102cddc12c983ccda)
+++ /dev/null (revision 20053c0a201388e02a45120102cddc12c983ccda)
@@ -1,37 +0,0 @@
-package org.acme.dynamodb;
-
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-@Path("/fruits")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public class FruitResource {
-
- @Inject
- FruitSyncService service;
-
- @GET
- public List<Fruit> getAll() {
- return service.findAll();
- }
-
- @GET
- @Path("{name}")
- public Fruit getSingle(String name) {
- return service.get(name);
- }
-
- @POST
- public List<Fruit> add(Fruit fruit) {
- service.add(fruit);
- return getAll();
- }
-}
\ No newline at end of file
Index: amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitSyncService.java
===================================================================
diff --git a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitSyncService.java b/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitSyncService.java
deleted file mode 100644
--- a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitSyncService.java (revision 20053c0a201388e02a45120102cddc12c983ccda)
+++ /dev/null (revision 20053c0a201388e02a45120102cddc12c983ccda)
@@ -1,31 +0,0 @@
-package org.acme.dynamodb;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-
-@ApplicationScoped
-public class FruitSyncService extends AbstractService {
-
- @Inject
- DynamoDbClient dynamoDB;
-
- public List<Fruit> findAll() {
- return dynamoDB.scanPaginator(scanRequest()).items().stream()
- .map(Fruit::from)
- .collect(Collectors.toList());
- }
-
- public List<Fruit> add(Fruit fruit) {
- dynamoDB.putItem(putRequest(fruit));
- return findAll();
- }
-
- public Fruit get(String name) {
- return Fruit.from(dynamoDB.getItem(getRequest(name)).item());
- }
-}
\ No newline at end of file
Index: amazon-dynamodb-quickstart/src/test/java/org/acme/dynamodb/DynamodbResourcesTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/amazon-dynamodb-quickstart/src/test/java/org/acme/dynamodb/DynamodbResourcesTest.java b/amazon-dynamodb-quickstart/src/test/java/org/acme/dynamodb/DynamodbResourcesTest.java
--- a/amazon-dynamodb-quickstart/src/test/java/org/acme/dynamodb/DynamodbResourcesTest.java (revision 20053c0a201388e02a45120102cddc12c983ccda)
+++ b/amazon-dynamodb-quickstart/src/test/java/org/acme/dynamodb/DynamodbResourcesTest.java (date 1673022219352)
@@ -22,7 +22,7 @@
.format("{\"name\":\"%s\", \"description\":\"%s\"}", name, description);
@ParameterizedTest
- @ValueSource(strings = {"fruits", "async-fruits"})
+ @ValueSource(strings = {"async-fruits"})
void testResource(final String testedResource) {
List<String> data = Arrays.asList("Cherry", "Pear");
Index: amazon-dynamodb-quickstart/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/amazon-dynamodb-quickstart/pom.xml b/amazon-dynamodb-quickstart/pom.xml
--- a/amazon-dynamodb-quickstart/pom.xml (revision 20053c0a201388e02a45120102cddc12c983ccda)
+++ b/amazon-dynamodb-quickstart/pom.xml (date 1673022281173)
@@ -50,11 +50,12 @@
</dependency>
<dependency>
<groupId>io.quarkiverse.amazonservices</groupId>
- <artifactId>quarkus-amazon-dynamodb</artifactId>
+ <artifactId>quarkus-amazon-dynamodb-enhanced</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Essentially, I've removed the synchronous code and swapped the quarkus-amazon-dynamodb
extension for the quarkus-amazon-dynamodb-enhanced
extension. The Netty client was already included in the dependencies and I've moved the url-connection-client
to the test
scope because its still required by DynamodbResource
in order to create a DynamoDB table in localstack to run the tests. When I try to package the build, it fails with the following stacktrace:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:2.15.0.Final:build (default) on project amazon-dynamodb-quickstart: Failed to build quarkus application
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to build quarkus application
at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:170)
at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:154)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor#setup threw an exception: javax.enterprise.inject.spi.DeploymentException: Missing 'software.amazon.awssdk:url-connection-client' dependency on the classpath
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.missingDependencyException(AmazonServicesClientsProcessor.java:173)
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.setup(AmazonServicesClientsProcessor.java:122)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment (AugmentActionImpl.java:335)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication (AugmentActionImpl.java:175)
at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:133)
at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:154)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor#setup threw an exception: javax.enterprise.inject.spi.DeploymentException: Missing 'software.amazon.awssdk:url-connection-client' dependency on the classpath
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.missingDependencyException(AmazonServicesClientsProcessor.java:173)
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.setup(AmazonServicesClientsProcessor.java:122)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run (Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute (BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment (AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication (AugmentActionImpl.java:175)
at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:133)
at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:154)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: javax.enterprise.inject.spi.DeploymentException: Missing 'software.amazon.awssdk:url-connection-client' dependency on the classpath
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.missingDependencyException (AmazonServicesClientsProcessor.java:173)
at io.quarkus.amazon.common.deployment.AmazonServicesClientsProcessor.setup (AmazonServicesClientsProcessor.java:122)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run (BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1478)
at java.lang.Thread.run (Thread.java:829)
at org.jboss.threads.JBossThread.run (JBossThread.java:501)
If I revert to the quarkus-amazon-dynamodb
extension but keep my other changes, the build succeeds.
I've also tried adding the Apache HTTP client to the compile classpath but the build fails with the same error, i.e. the enhanced extension seems to require the url-connection-client
to be on the compile classpath.
Hello,
Thanks for this great work :-)
It would be awesome to have a Quarkus extension "DynamoDB with Panache" like we have MongoDB with Panache and Hibernate with Panache.
It would simplified a lot the mapping between POJO and the DynamoDB JSON format!
Hello,
I am following along with Quarkus guides on Amazon S3.
Based off of these examples I am trying to write a REST endpoint that returns objects of type
When using the example directly (adapted to my code) it looks a bit a like this:
@Override
public Uni<Response> getFile(String bucket, String objectKey, String filename) {
return Uni.createFrom()
.completionStage(() -> s3.getObject(buildGetRequest(bucket, objectKey), AsyncResponseTransformer.toBytes()))
.onItem()
.transform(object -> Response.ok(object.asUtf8String())
.type(object.response().contentType())
.header("Content-Disposition", "attachment;filename=" + filename)
.header("Content-Type", object.response().contentType()).build());
}
This results in the following error:
java.io.UncheckedIOException: Cannot encode string
I double checked and the images do display and are valid when viewing them in the ecs browser gui directly. The images are uploaded from a browser so I expect them to be in UTF8 already.
I experimented with trying object.asInputStream()
and object.asByteBuffer()
and these to successfully return the object as a file to the browser downloading the file.
However once viewing the image that was downloaded I found that they are twice the size as the original image and that they are invalid pngs / jpegs.
When trying to download a pdf with the same code, I get a pdf back that is also larger, and it displays in a browser however the content is gone.
Ultimately I have found that the only format I can get back using this code is plain text.
@Produces( { "image/png", "image/jpeg", "application/pdf", "text/csv", "text/plain" })
to the rest resourceobject.asUtf8String()
for other methods.type
on Response
eg: .type(object.response().contentType())
Any input is appreciated.
To use AWS services from the EKS cluster's pod, you need to configure WebIdentityTokenFileCredentialsProvider
as credentials provider. This is not in the DefaultCredentialsProvider
's chain. Or a way to configure any custom AwsCredentialsProvider provider is needed.
Docs mention that Object Mappers (DynamoDBMapper) are not supported. Will this come? I found a stackoverflow question where DynamoDBMapper is used with Quarkus but I dont know how when this extension doesnt support it.
When quarkus bom update testcontainer to 1.18.0, aws sdk1 dependency can be removed.
Is there support for this?
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-apigatewaymanagementapi</artifactId>
<version>1.12.341</version>
</dependency>
More details here quarkusio/quarkus#29243
Localstack 2.0 was released on March 30th which does not support legacy init scripts. Deprecation warning.
As this library defaults to the latest image, I'd imagine I'm not the only one who spent an hour debugging why this feature is not working as expected :)
It would be very useful to my organisation if Quarkus Amazon Services included timestream. Currently we have to pull in the software.amazon.awssdk version
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>timestreamwrite</artifactId>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>timestreamquery</artifactId>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
testing this is a real pain as it's not picked up as a service by localstack when running tests:
[io.qua.ama.com.dep.DevServicesLocalStackProcessor] (build-29) Amazon Dev Services for localstack (sqs, dynamodb) started
so we end up with limited integration tests of this part of our stack
It seems that the json messages that Kinesis send use some quirky conventions that don't play well with Jackson. Amazon work around this by configuring Jackson mixins in com.amazonaws:aws-lambda-java-serialization:1.0.0
but as Quarkus has it's own ObjectMapper I found that I needed to implement my own equivalent and apply them using ObjectMapperCustomizer. It would be convenient if this could be taken care of by a io.quarkiverse.amazonservices based artefact. Either something Kinesis specific or perhaps a general package that essentially provide the same as com.amazonaws:aws-lambda-java-serialization:1.0.0
but in a way that is easy to setup with Quarkus
Add support to create SQS queues on devservices startup using quarkus.sqs.devservices.queues
.
Like provision S3 locally via Dev Services using quarkus.s3.devservices.buckets
.
Currently aws.devservices.localstack uses "latest" version, which is sometimes unstable. And this may lead to issues like that localstack/localstack#7620
As I can see, for integration tests quarkus uses fixed version:
quarkus.aws.devservices.localstack.image-name=localstack/localstack:0.13.1
May be it makes sense to also fix localstack version in devservices to avoid floating issues?
Topic says it all. I used latest and its not working (error is that the table does not exist). If I use the tag which is in the readme (which is 3 years old) it works.
Hello,
I am trying to connect to a S3 with an URL having DNS value and it doesn't work.
For example, localhost is not working, to make it work I have to use 127.0.0.1
Same thing when using in a docker, I cannot use DNS values generated by docker but I have to use the raw IP address.
Any idea how to solve this?
It is working for any other service such as a database..
use ses send email after query some in reactive env will cause this error
@Singleton
public class AWSEmailService implements EmailService {
@Inject SesAsyncClient sesAsyncClient;
@Override
public Uni<Boolean> sendMail(String email, String subject, String content) {
var body = Templates.welcome(content).render();
var x =
sesAsyncClient.sendEmail(
req ->
req.source("[email protected]")
.destination(d -> d.toAddresses(email))
.message(
msg ->
msg.subject(subj -> subj.data("subject"))
.body(b -> b.html(html -> html.data(body)))));
return Uni.createFrom()
.completionStage(x)
.onItem()
.transform(sendEmailResponse -> sendEmailResponse.sdkHttpResponse().isSuccessful());
}
}
@GET
@Path("/gaga")
@ReactiveTransactional
public Uni<Boolean> gagaga() {
return Uni.createFrom()
.item("[email protected]")
.flatMap(email -> awsEmailService.sendMail(email, "test", "test"));
}
will cause this error
Using Quarkus 2.15.4 in Dev mode I am attempting to use a localstack DynamoDB instance.
I have followed the steps in the docs for the settings (region, endpoint override, credentials etc), however, the DynamoDbClient I am presented with by the DynamoDbClientProducer ignores these and just produces a client based on my default profile in my was credentials file, e.g. the endpoint might be https://dynamodb.eu-west-2.amazonaws.com where I have specified http://localhost:4566. I have confirmed that the only thing I can change is the endpoint if I specify a different region in the credentials file.
The settings I am specifying do show up in the Dev UI, apart from credentials.type for some reason, and things like OIDC client settings are being handled correctly, so I'm sure it's nothing to do with a problem with the application.properties file or entries.
S3Presigner CDI injection not working.
ERROR LOG:
Caused by: java.lang.IllegalStateException: The S3Presigner is required but has not been detected/configured.
at io.quarkus.amazon.s3.runtime.S3ClientProducer.presigner(S3ClientProducer.java:50)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_Subclass.presigner$$superforward1(Unknown Source)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_Subclass$$function$$3.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_Subclass.presigner(Unknown Source)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_presigner_67d945a0bddf1bbe94c84fc632b6219048063e1d_Bean.create(Unknown Source)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_presigner_67d945a0bddf1bbe94c84fc632b6219048063e1d_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:18)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_presigner_67d945a0bddf1bbe94c84fc632b6219048063e1d_ClientProxy.arc$delegate(Unknown Source)
at io.quarkus.amazon.s3.runtime.S3ClientProducer_ProducerMethod_presigner_67d945a0bddf1bbe94c84fc632b6219048063e1d_ClientProxy.presignGetObject(Unknown Source)
Workaround:
Inject S3Client also
or
Use S3Presigner.builder().build();
Example code:
@ApplicationScoped
public class AwsService {
@ConfigProperty(name = "cloud.storage.s3.presigned-url.timeout")
int presignedUrlTimeout;
@Inject
S3Presigner s3Presigner;
/**
* Do not remove the s3client injection as s3Presigner won't initialize without it
*/
@Inject
S3Client s3;
private S3Presigner s3PresignerLocal;
public AwsService() {
this.s3PresignerLocal = S3Presigner.builder().build();
}
public String getPresignedGetUrl(String bucketName, String key) {
GetObjectRequest getObjectRequest =
GetObjectRequest.builder()
.bucket(bucketName)
.key(key)
.build();
GetObjectPresignRequest getObjectPresignRequest =
GetObjectPresignRequest.builder()
.signatureDuration(Duration.ofMinutes(this.presignedUrlTimeout))
.getObjectRequest(getObjectRequest)
.build();
// Generate the presigned request
PresignedGetObjectRequest presignedGetObjectRequest =
this.s3Presigner.presignGetObject(getObjectPresignRequest);
// PresignedGetObjectRequest presignedGetObjectRequest =
// this.s3PresignerLocal.presignGetObject(getObjectPresignRequest);
return presignedGetObjectRequest.url().toString();
}
quarkus-amazon-services version: 1.0.3
Java Version: openjdk version "17.0.1" 2021-10-19 LTS
In some cases it's required to use custom AwsCredentialsProvider instance for the client.
Currently it's only possible to achieve that by building your own client with builder (and thus loosing all other quarkus configs and features for this service).
Would be nice to have some analog of quarkus.datasource.credentials-provider-name
I try to provide some additional configuration for SdkHttpClient, specifically the TCP Keep-Alive option.
I see that there isn't a seperate config option on Quarkiverse level, but is there some way to provide a custom SdkHttpClient which gets picked up by the Quarkiverse-managed SnsClient?
Dear quarkiverse team,
I propose adding an extension to quarkus-amazon-services for interacting with Amazon Web Services (AWS) Step Functions.
AWS Step Functions is a fully managed service that enables developers to build, test, and run workflows that execute as a series of steps. These workflows can be triggered by a variety of events, such as an HTTP request, a scheduled time, or the completion of a downstream task. Step Functions make it easy to coordinate and execute complex, long-running processes asynchronously, which can be particularly useful in microservices architectures.
Adding an extension for AWS Step Functions to quarkiverse would enable developers to easily incorporate Step Functions into their Quarkus applications, making it possible to build, deploy, and run workflows that coordinate the execution of microservices and other components.
The extension would be called something like io.quarkiverse.amazonservices:quarkus-amazon-stepfunctions
I believe that this extension would be a valuable addition to quarkiverse, as it would allow developers to take advantage of the benefits of Step Functions when building cloud-native applications.
Thank you for considering this proposal.
hashtags: #quarkus #aws #stepfunctions #microservices #cloudnative #workflow #coordination #async #extension proposal
Sincerely,
Cรฉsar Aguilera
Hello @team Can we upgrade the quarkus-amazon-services package to support Quarkus 3.0?
Quarkus migration tips: https://github.com/quarkiverse/quarkiverse/wiki/Migrating-to-Quarkus-3.x
Hi, there!
Does any reason why extension for enhanced dynamodb client don't implemented?
May be some technical limitation or etc?
This issue happens only with the real AWS account, see apache/camel-quarkus#3829
It looks like checksum-validation
is enabled by default. So I think it is possible to improve to disable it explicitly when it is used in browser compatible
.
AWS delivers four Extension which support functionality like the JPA Annotations: @Version
or @CreationTimestamp
I guess we could add this to AmazonServicesClientsProcessor and add a configuration property like quarkus.dynamodb.client.extensions=VersionedRecordExtension,AutoGeneratedTimestampRecordExtension,AtomicCounterExtension
Perhaps I could try to provide a PR?
When upgrading from 1.1.1
to 1.6.3
to use DevServices the familiar Unable to load an HTTP implementation from any provider in the chain
error popped up.
We only use asynchronous clients so don't need a synchronous client for application code.
DevServices docs should point this requirement out in big bold letters ๐
Hello all,
I was wondering if there are any plans to create an extension for EventBridge? I assume I can build a native Quarkus executable
using the https://aws.amazon.com/blogs/developer/graalvm-native-image-support-in-the-aws-sdk-for-java-2-x/ but it would be nice to get the plug-and-play benefit of an extension.
I am trying to use this extension to manipulate S3 object in a bucket from Scaleway S3 Storage
I followed the tutorial from https://quarkiverse.github.io/quarkiverse-docs/quarkus-amazon-services/dev/amazon-s3.html and I use the following configuration in application.properties
quarkus.s3.endpoint-override=https://s3.fr-par.scw.cloud
quarkus.s3.aws.region=fr-par
quarkus.s3.aws.credentials.type=static
quarkus.s3.aws.credentials.static-provider.access-key-id=xxxx
quarkus.s3.aws.credentials.static-provider.secret-access-key=xxxxxx
bucket.name=my-bucket
After starting quarkus in dev mode, when I go to the http://localhost:8080/s3.html page I have the following error in the logs which prevent to start the app :
2023-02-14 10:54:56,180 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (vert.x-worker-thread-1) Failed to start quarkus: io.quarkus.dev.appstate.ApplicationStartException: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:58)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:123)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:222)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:203)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:537)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:437)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:152)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:139)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:108)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
... 1 more
Caused by: io.quarkus.runtime.configuration.ConfigurationException: One or more configuration errors have prevented the application from starting. The errors are:
- SRCFG00039: The config property quarkus.s3.aws.region with the config value "fr-par" threw an Exception whilst being converted value fr-par is not a valid AWS Region [ap-south-2, ap-south-1, eu-south-1, eu-south-2, us-gov-east-1, me-central-1, ca-central-1, eu-central-1, us-iso-west-1, eu-central-2, us-west-1, us-west-2, af-south-1, eu-north-1, eu-west-3, eu-west-2, eu-west-1, ap-northeast-3, ap-northeast-2, ap-northeast-1, me-south-1, sa-east-1, ap-east-1, cn-north-1, us-gov-west-1, ap-southeast-1, ap-southeast-2, us-iso-east-1, ap-southeast-3, us-east-1, us-east-2, cn-northwest-1, us-isob-east-1, aws-global, aws-cn-global, aws-us-gov-global, aws-iso-global, aws-iso-b-global]
Am I doing something wrong ? or it is not possible to use this Quarkus extension with a S3 Provider (here Scaleway) which is not AWS ?
@scrocquesel wondering if you would be interested in having a look?
It should be done in the development
branch here: https://github.com/quarkusio/quarkus-quickstarts/tree/development .
I would start with the S3 one as it's the one in which I originally spotted the issue. The idea would be to switch to dev services but I have something suspicious when doing it.
I had a quick try with this diff:
diff --git a/amazon-s3-quickstart/pom.xml b/amazon-s3-quickstart/pom.xml
index 0eadde56..100a65a9 100644
--- a/amazon-s3-quickstart/pom.xml
+++ b/amazon-s3-quickstart/pom.xml
@@ -16,7 +16,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
- <quarkus-amazon-services.version>1.3.1</quarkus-amazon-services.version>
+ <quarkus-amazon-services.version>1.5.0</quarkus-amazon-services.version>
<awssdk.testcontainers.version>1.12.57</awssdk.testcontainers.version>
</properties>
diff --git a/amazon-s3-quickstart/src/main/resources/application.properties b/amazon-s3-quickstart/src/main/resources/application.properties
index bf6096ae..739d4c08 100644
--- a/amazon-s3-quickstart/src/main/resources/application.properties
+++ b/amazon-s3-quickstart/src/main/resources/application.properties
@@ -1,5 +1,3 @@
-quarkus.s3.endpoint-override=http://localhost:8008
-
quarkus.s3.aws.region=us-east-1
quarkus.s3.aws.credentials.type=static
quarkus.s3.aws.credentials.static-provider.access-key-id=test-key
diff --git a/amazon-s3-quickstart/src/test/java/org/acme/s3/S3Resource.java b/amazon-s3-quickstart/src/test/java/org/acme/s3/S3Resource.java
deleted file mode 100644
index 298ca454..00000000
--- a/amazon-s3-quickstart/src/test/java/org/acme/s3/S3Resource.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.acme.s3;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.testcontainers.DockerClientFactory;
-import org.testcontainers.containers.localstack.LocalStackContainer;
-import org.testcontainers.containers.localstack.LocalStackContainer.EnabledService;
-import org.testcontainers.containers.localstack.LocalStackContainer.Service;
-import org.testcontainers.utility.DockerImageName;
-
-import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3Client;
-
-public class S3Resource implements QuarkusTestResourceLifecycleManager {
-
- private static final DockerImageName LOCALSTACK_IMAGE_NAME = DockerImageName.parse("localstack/localstack")
- .withTag("0.12.17");
- private final static String BUCKET_NAME = "quarkus.test.bucket";
-
- private LocalStackContainer container;
- private S3Client client;
-
- @Override
- public Map<String, String> start() {
- DockerClientFactory.instance().client();
- try {
- container = new LocalStackContainer(LOCALSTACK_IMAGE_NAME).withServices(Service.S3);
- container.start();
-
- URI endpointOverride = container.getEndpointOverride(EnabledService.named(Service.S3.getName()));
-
- client = S3Client.builder()
- .endpointOverride(endpointOverride)
- .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("accesskey", "secretKey")))
- .httpClientBuilder(UrlConnectionHttpClient.builder())
- .region(Region.US_EAST_1).build();
-
- client.createBucket(b -> b.bucket(BUCKET_NAME));
-
- Map<String, String> properties = new HashMap<>();
- properties.put("quarkus.s3.endpoint-override", endpointOverride.toString());
- properties.put("quarkus.s3.aws.region", "us-east-1");
- properties.put("quarkus.s3.aws.credentials.type", "static");
- properties.put("quarkus.s3.aws.credentials.static-provider.access-key-id", "accessKey");
- properties.put("quarkus.s3.aws.credentials.static-provider.secret-access-key", "secretKey");
- properties.put("bucket.name", BUCKET_NAME);
-
- return properties;
- } catch (Exception e) {
- throw new RuntimeException("Could not start S3 localstack server", e);
- }
- }
-
- @Override
- public void stop() {
- if (container != null) {
- container.close();
- }
- }
-}
diff --git a/amazon-s3-quickstart/src/test/java/org/acme/s3/S3ResourcesTest.java b/amazon-s3-quickstart/src/test/java/org/acme/s3/S3ResourcesTest.java
index 95767f93..2f984ae2 100644
--- a/amazon-s3-quickstart/src/test/java/org/acme/s3/S3ResourcesTest.java
+++ b/amazon-s3-quickstart/src/test/java/org/acme/s3/S3ResourcesTest.java
@@ -3,21 +3,20 @@ package org.acme.s3;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.junit.QuarkusTest;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Map;
+
import javax.ws.rs.core.Response.Status;
-import org.jetbrains.annotations.NotNull;
+
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import io.quarkus.test.junit.QuarkusTest;
+
@QuarkusTest
-@QuarkusTestResource(S3Resource.class)
public class S3ResourcesTest {
private static final String FILE_NAME_PREFIX = "test-file-";
but I end up with the following exception when executing the tests:
Caused by: java.lang.NullPointerException: host must not be null.
at software.amazon.awssdk.utils.Validate.paramNotNull(Validate.java:156)
at software.amazon.awssdk.http.DefaultSdkHttpFullRequest.<init>(DefaultSdkHttpFullRequest.java:56)
at software.amazon.awssdk.http.DefaultSdkHttpFullRequest.<init>(DefaultSdkHttpFullRequest.java:44)
at software.amazon.awssdk.http.DefaultSdkHttpFullRequest$Builder.build(DefaultSdkHttpFullRequest.java:482)
at software.amazon.awssdk.http.DefaultSdkHttpFullRequest$Builder.build(DefaultSdkHttpFullRequest.java:250)
at software.amazon.awssdk.services.s3.endpoints.internal.AwsEndpointProviderUtils.setUri(AwsEndpointProviderUtils.java:178)
at software.amazon.awssdk.services.s3.endpoints.internal.S3RequestSetEndpointInterceptor.modifyHttpRequest(S3RequestSetEndpointInterceptor.java:35)
at software.amazon.awssdk.core.interceptor.ExecutionInterceptorChain.modifyHttpRequestAndHttpContent(ExecutionInterceptorChain.java:90)
at software.amazon.awssdk.core.internal.handler.BaseClientHandler.runModifyHttpRequestAndHttpContentInterceptors(BaseClientHandler.java:157)
at software.amazon.awssdk.core.internal.handler.BaseClientHandler.finalizeSdkHttpFullRequest(BaseClientHandler.java:83)
at software.amazon.awssdk.core.internal.handler.BaseAsyncClientHandler.doExecute(BaseAsyncClientHandler.java:201)
Quarkus support for the amazon sqs extended client.
See: https://github.com/awslabs/amazon-sqs-java-extended-client-lib
I'm using SQS dev services succesfully in @QuarkusTest.
@InjectSpy
protected lateinit var sqsClient: SqsClient
@BeforeAll
fun setUp() {
sqsClient.createQueue(CreateQueueRequest.builder().queueName("TestQueue").build())
}
But in @QuarkusIntegrationTest SqsClient is not initialized.
kotlin.UninitializedPropertyAccessException: lateinit property sqsClient has not been initialized
Should it be possible to use sqs dev services to test native image?
Hi,
quarkus.s3.sync-client.tls-trust-managers-provider.type=trust-all
requires to set both quarkus.s3.sync-client.tls-trust-managers-provider.file-store.path/type
to be applied on the client.
I guess the check could be removed as the validator already check the config for file-store
provider.
Based on the sqs documentation, my understanding is, that message.body()
should return only the message payload instead of the whole message. Assuming there is a sqs message like this:
{
"Type": "Notification",
"MessageId": "880e87a8-f91d-5d48-8611-dce078ade862",
"TopicArn": "arn:aws:sns:eu-central-1:11111111:ConfirmMailOnRegistrationRequested",
"Subject": "ConfirmMailOnRegistrationRequested",
"Message": "{\"eventType\":\"ConfirmMailOnRegistrationRequested\",\"payload\":{\"foo\": \"bar\"}}",
"Timestamp": "2022-07-13T08:16:48.085Z",
"SignatureVersion": "1",
"Signature": "gjewklgjelgew",
"SigningCertURL": "https://sns.eu-central-1.amazonaws.com/SimpleNotificationService-11111.pem",
"UnsubscribeURL": "https://sns.eu-central-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-central-1:11111:ConfirmMailOnRegistrationRequested:03b6a158-53dc-4b93-bb7c-dfd69bee9ca2"
}
I'd assume message.body()
returning the string:
{"eventType":"ConfirmMailOnRegistrationRequested", "payload":{"foo": "bar"}}
Given the following example code, this is not the case though:
@IfBuildProfile("prod")
@ApplicationScoped
class EventHandler(
val sqs: SqsAsyncClient,
@ConfigProperty(name = "event.queue.url")
val sqsUrl: String,
val vertxEventBus: EventBus
) {
@Scheduled(every = "10s")
suspend fun receiveEvents() {
val messageRequestBuilder = ReceiveMessageRequest
.builder()
.queueUrl(sqsUrl)
.maxNumberOfMessages(10)
.build()
val response = sqs.receiveMessage(messageRequestBuilder).await()
val messages = response.messages()
messages.forEach { m ->
val body = m.body()
Log.info("Received event: $body")
}
}
}
Instead of only logging the content fo the Message
field, this code prints the full message. The documentation states this code as an example:
@GET
public List<Quark> receive() {
List<Message> messages = sqs.receiveMessage(m -> m.maxNumberOfMessages(10).queueUrl(queueUrl)).messages();
return messages.stream()
.map(Message::body)
.map(this::toQuark)
.collect(Collectors.toList());
}
private Quark toQuark(String message) {
Quark quark = null;
try {
quark = QUARK_READER.readValue(message);
} catch (Exception e) {
LOGGER.error("Error decoding message", e);
throw new RuntimeException(e);
}
return quark;
}
For my understanding, this should not work as well, as the same steps are applied as in my code.
Is this a bug or maybe somehow related to the kotlin suspend functionality I am using or is the documentation not up-to-date?
The quarkus-extension.yaml for io.quarkiverse.amazonservices:quarkus-amazon-cognito-user-pools
points to a guide at https://quarkus.io/guides/amazon-cognitouserpools, but this page does not exist.
I haven't created a PR since I'm not sure if it's better to create a guide page or remove the guides line in the extension metadata. Probably, even if a guide is created, it would be in the quarkiverse docs rather than the main quarkus guides, so the metadata would need updating in both cases.
See also quarkusio/quarkus#31149, which would update the extension template so that it's harder to end up accidentally publishing extensions with dead guide links.
I noted that properties for localstack get passed to it via quarkus.aws.devservices.localstack.container-properties.[*]=*
, so I tried using this to add a SERVICES
value in the hope that devservices would see that and append others to it rather than simply clobbering it with the values from the BuildItem
s.
Spoiler: it clobbers it.
I've looked around and couldn't find anything that would help. The "golden path" of writing an extension to do this with a DevServicesLocalStackProviderBuildItem
is way overkill^(1) for the use case of enabling additional localstack services IMO^(2).
Would this clobbering of SERVICES
be considered a bug? If not, consider this my vote for it to be one and to start the conversation.
(1) not to mention issues including the extension's gradle project into a non-extension gradle project so it can be used without having to publish it, but I digress
(2) that's not to say that extensions should not be written, just that for the use case of "enabling extra localstack services" it's not necessary
Regarding needs for dynamodb and s3, the extension should provide support for devservices for each proposed services.
It will allow to get rid of the maven docker plugin in integration tests.
Currently, localstack is used in integration for all services but cognito. Cognito use moto.
Sharing container should be supported in dev mode. See discussion in #173 for some design limitation. In test mode, it would be nice to reduce footprint by having a all in one container.
In our projects to write integration tests with dynamodb we use testcontainers.
Using such TestRecourse.
public class DdbLocalResource implements QuarkusTestResourceLifecycleManager {
private static final int DYNAMODB_PORT = 8000;
public static GenericContainer<?> dynamodb =
// new GenericContainer<>("amazon/dynamodb-local")
new GenericContainer<>("dimaqq/dynalite:latest")
.withExposedPorts(DYNAMODB_PORT);
@Override
public Map<String, String> start() {
dynamodb.start();
return Map.of(
"quarkus.dynamodb.endpoint-override", String.format("http://%s:%s",
dynamodb.getContainerIpAddress(), dynamodb.getMappedPort(DYNAMODB_PORT)),
"quarkus.dynamodb.aws.credentials.type", "static",
"quarkus.dynamodb.aws.credentials.static-provider.access-key-id", "not-exits",
"quarkus.dynamodb.aws.credentials.static-provider.secret-access-key", "not-exists",
"quarkus.dynamodb.aws.region", "eu-central-1"
);
}
@Override
public void stop() {
dynamodb.stop();
}
}
Would be nice to have something like that out of the box.
Currently it's not possible to specify custom producer for amazon client.
This means you are not allowed to adjust client options if they are not supported by extension.
For example, if you want to use some custom credentials provider, or do fine-tuning of the client, you create your own @Producer
for client.
But in this case you'll get "Ambiguous dependencies" error, so you are forced to use @Named
annotation everywhere.
Is there an option to bypass this, and use "custom" client instead of default one?
It looks like it's just enough to mark default quarkus client producers with @DefaultBean annotation.
Don't see any drawbacks of such change.
First of all, thanks for your work on Quarkus/Quarkiverse. We really enjoy working with Quarkus. :)
We are using Quarkus version 2.14.3.Final and quarkus-amazon-services version 1.3.1
To access DynamoDb we use the quarkus-amazon-dynamodb-enhanced
extension.
Now we want to introduce opmtistic locking for an entity. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.OptimisticLocking.html
We added a field with the annotation @DynamoDBVersionAttribute
which is provided by the aws SDK for this purpose.
Non-native it works as expected (version is set to 1 on insertion, then incremented with each update). Native a ConditionalCheckFailedException
is thrown while inserting a new entity.
Based on https://github.com/quarkusio/quarkus-quickstarts/tree/main/amazon-dynamodb-quickstart and https://quarkiverse.github.io/quarkiverse-docs/quarkus-amazon-services/dev/amazon-dynamodb.html#_dynamodb_enhanced_client I prepared a sample project to reproduce the issue.
You can find the sample project at https://github.com/dagrammy/DynamoDbVersionAttribute-test.
./mvnw install
-> BUILD SUCCESS
./mvnw install -Dnative
-> BUILD FAILURE
Complete log: https://github.com/dagrammy/DynamoDbVersionAttribute-test/blob/main/README.md
HTTP Request to /fruits failed, error id: 641e581d-abc1-4585-8ddb-bec115b262b3-1: software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException: The conditional request failed (Service: DynamoDb, Status Code: 400, Request ID: ODARM82TCOGF31YLKRI9QIU57OGW2SNPZ1DJTCVW9PFX3NY3D74C)
at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleErrorResponse(CombinedResponseHandler.java:125)
at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleResponse(CombinedResponseHandler.java:82)
at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:60)
at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handle(CombinedResponseHandler.java:41)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:40)
at software.amazon.awssdk.core.internal.http.pipeline.stages.HandleResponseStage.execute(HandleResponseStage.java:30)
at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:73)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptTimeoutTrackingStage.execute(ApiCallAttemptTimeoutTrackingStage.java:42)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:78)
at software.amazon.awssdk.core.internal.http.pipeline.stages.TimeoutExceptionHandlingStage.execute(TimeoutExceptionHandlingStage.java:40)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:50)
at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallAttemptMetricCollectionStage.execute(ApiCallAttemptMetricCollectionStage.java:36)
Is there a way to use the opmtistic locking feature in native builds?
Thanks in advance!
Hi,
How to get secret as environnement variable from aws secretsmanager, is there an extension to do that ?
The need is to allow adding configuration inside the application.properties or application.yml at startup available for application boot.
Thank's
Best regards,
RAQAOUI MOHAMED
Hello all,
I am using the asynchronous DynamoDbAsyncClient
in my Quarkus AWS Lambda project. This lambda is consuming events from a MSK topic and processing events and updating/inserting data into DynamoDB.
I am using Quarkus version 2.13.3.Final
and quarkus-amazon-services
version 1.3.1
The project is compiled as a native container image and it runs pretty smoothly until after a while when I start seeing these errors crop up
exception:{ refId:1 exceptionType:software.amazon.awssdk.core.exception.SdkClientException message: Unable to execute HTTP request: Acquire operation took longer than the configured maximum time. This indicates that a request cannot get a connection from the pool within the specified maximum time. This can be due to high request rate. Consider taking any of the following actions to mitigate the issue: increase max connections, increase acquire timeout, or slowing the request rate. Increasing the max connections can increase client throughput (unless the network interface is already fully utilized), but can eventually start to hit operation system limitations on the number of file descriptors used by the process. If you already are fully utilizing your network interface or cannot further increase your connection count, increasing the acquire timeout gives extra time for requests to acquire a connection before timing out. If the connections doesn't free up, the subsequent requests will still timeout. If the above mechanisms are not able to fix the issue, try smoothing out your requests so that large traffic bursts cannot overload the client, being more efficient with the number of times you need to call AWS, or by increasing the number of hosts sending requests. frames:[ { class:software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl method:build line:102 } { class:software.amazon.awssdk.core.exception.SdkClientException method:create line:47 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper method:setLastException line:204 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper method:setLastException line:200 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryingExecutor method:maybeRetryExecute line:179 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryingExecutor method:lambda$attemptExecute$1 line:159 } { class:java.util.concurrent.CompletableFuture method:uniWhenComplete line:863 } { class:java.util.concurrent.CompletableFuture$UniWhenComplete method:tryFire line:841 } { class:java.util.concurrent.CompletableFuture method:postComplete line:510 } { class:java.util.concurrent.CompletableFuture method:completeExceptionally line:2162 } { class:software.amazon.awssdk.utils.CompletableFutureUtils method:lambda$forwardExceptionTo$0 line:76 } { class:java.util.concurrent.CompletableFuture method:uniWhenComplete line:863 } { class:java.util.concurrent.CompletableFuture$UniWhenComplete method:tryFire line:841 } { class:java.util.concurrent.CompletableFuture method:postComplete line:510 } { class:java.util.concurrent.CompletableFuture method:completeExceptionally line:2162 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage method:lambda$null$0 line:103 } { class:java.util.concurrent.CompletableFuture method:uniWhenComplete line:863 } { class:java.util.concurrent.CompletableFuture$UniWhenComplete method:tryFire line:841 } { class:java.util.concurrent.CompletableFuture method:postComplete line:510 } { class:java.util.concurrent.CompletableFuture method:completeExceptionally line:2162 } { class:software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage method:lambda$executeHttpRequest$3 line:165 } { class:java.util.concurrent.CompletableFuture method:uniWhenComplete line:863 } { class:java.util.concurrent.CompletableFuture$UniWhenComplete method:tryFire line:841 } { class:java.util.concurrent.CompletableFuture$Completion method:run line:482 } { class:java.util.concurrent.ThreadPoolExecutor method:runWorker line:1136 } { class:java.util.concurrent.ThreadPoolExecutor$Worker method:run line:635 } { class:java.lang.Thread method:run line:833 } { class:com.oracle.svm.core.thread.PlatformThreads method:threadStartRoutine line:704 } { class:com.oracle.svm.core.posix.thread.PosixPlatformThreads method:pthreadStartRoutine line:202 } ]
I have tried modifying the documented netty parameters without luck. They are currently set to:
quarkus.dynamodb.async-client.max-concurrency=200
quarkus.dynamodb.async-client.connection-timeout=30S
quarkus.dynamodb.async-client.connection-acquisition-timeout=30S
According to my metrics I am only receiving a very low volume of events which I am processing and calling PutItem
, UpdateItem
and DeleteItem
methods in the DynamoDbAsyncClient
which I have injected into my @ApplicationScoped service.
The greatest number I have seen is about 20 events per lambda call so I cannot imagine I am making too many asynchronous requests that would consume up all the connection pool inside Netty. Is there a configuration detail I may be missing or some clean up operation that I need to make sure gets executed by the Quarkus framework?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.