Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use SQS Large Message Handling with Gradle #369

Closed
andavies opened this issue Apr 16, 2021 · 7 comments
Closed

Unable to use SQS Large Message Handling with Gradle #369

andavies opened this issue Apr 16, 2021 · 7 comments

Comments

@andavies
Copy link

I have an AWS Lambda function that receives an SQSEvent. I need to enable support for large messages that are stored in S3.

I'm following the instructions here: https://awslabs.github.io/aws-lambda-powertools-java/utilities/sqs_large_message_handling/
I'm using Gradle, so I add this to my build.gradle as described:

dependencies { ... implementation 'software.amazon.lambda:powertools-sqs:1.5.0' aspectpath 'software.amazon.lambda:powertools-sqs:1.5.0' }

Error: Could not find method aspectpath() for arguments [software.amazon.lambda:powertools-sqs:1.5.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Ok so I gather I need to add the AspectJ plugin, like in the Maven example (although not mentioned in the Gradle example).
In the Maven example you use the one by org.codehaus.mojo, but there doesn't seem to be an equivalent for Gradle. This one seems like the official plugin for Gradle - https://plugins.gradle.org/plugin/aspectj.gradle - so I use that.

plugins { id "aspectj.gradle" version "0.1.6" }

Error: You must set the property 'aspectjVersion' before applying the aspectj plugin

Stack Overflow https://stackoverflow.com/questions/55753896/gradle-error-you-must-set-the-property-aspectjversion-before-applying-the-as tells me to define the version in gradle.properties so I do that

Error: java.lang.IllegalStateException: Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead.

Google leads me to this issue #146

I'm using Gradle 6, and I can't drop to Gradle 5 in my workplace. So like the issue says I use a different AspectJ plugin: https://plugins.gradle.org/plugin/aspectj.AspectjGradlePlugin.

It now builds. I run my tests...

Error: Task :compileAspect warning You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.

That's this issue: projectlombok/lombok#2592. So I add the workaround to my build process options:

-Djps.track.ap.dependencies=false

I run the tests again.

`Unable to find method ''org.gradle.internal.deprecation.DeprecationMessageBuilder$DeprecateProperty$WithDeprecationTimeline org.gradle.internal.deprecation.DeprecationMessageBuilder$DeprecateProperty.willBeRemovedInGradle8()''
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes`

At this point I'm seriously considering my career choices. I restart my IDE and kill all Java processes. I reimport my dependencies. Same error. This time I click on:

Re-download dependencies and sync project (requires network)

Same error. I click on

Stop Gradle build processes (requires restart)

Same error.

I'm out of options. I've lost a whole day to this.

Please can you tell me how I can use SQS Large Message Handling using Gradle, and provide working instructions on your documentation. OR - is there an alternative way I can receive large SQS messages (that are offloaded to S3) in my lambda function?

@heitorlessa
Copy link
Contributor

cc @msailes @pankajagrawal16 @jeromevdl could take a look into this, please?

@pankajagrawal16
Copy link
Contributor

pankajagrawal16 commented Apr 22, 2021

Hi @andavies ,

Apologies for delay in response. I have been out sick but now recovering.

I pushed a sample gradle repo which is using SQS module as well. It is using java 11 and gradle 6. This is how my build.gradle looks. Let me know if this helps to get things working for you?

An easy way to start with initial setup is to use Quick hello world examples using SAM CLI mentioned here. I basically started with this in the sample repo above and then added sqs module specific dependencies.

If use of annotation SqsLargeMessage is not desired, you can also opt to use fluent API also show in sample repo that I pushed.

For the documentation, install steps are mentioned here but maybe we can make it more explicit somehow.

Let me know if this solves your issues and feel free to update the issue accordingly.

@pankajagrawal16
Copy link
Contributor

Hi @andavies ,

Hope this works for you now?

@pankajagrawal16
Copy link
Contributor

Hi @andavies,

Did you get around testing it again?

@andavies
Copy link
Author

andavies commented May 31, 2021 via email

@andavies
Copy link
Author

andavies commented Jun 1, 2021

Ok so I took the following from your build.gradle and put it into my own...

plugins {
    id 'aspectj.AspectjGradlePlugin' version '0.0.6'
}
dependencies {
     implementation 'software.amazon.lambda:powertools-sqs:1.5.0'    
     aspectpath 'software.amazon.lambda:powertools-sqs:1.5.0'
}

and I get the error You must set the property 'aspectjVersion' before applying the aspectj plugin.

Thank you for your help - I'm sure there's a fix to this error as well, but honestly it's just not worth me spending any more time trying to fix it - I made a little workaround that avoids having to use powertools. Feel free to close the issue and thanks again.

@pankajagrawal16
Copy link
Contributor

Ok thanks for the feedback. I will close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants