Skip to content

docs: HelloWorldStreamFunction in examples fails with sam #1532

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

Merged
merged 67 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e66095e
Setting up Kotlin environment. Converting test to Kotlin.
Oct 2, 2023
ea0b496
Deploying via SAM successfully.
Oct 2, 2023
615a095
Added Kotlin example.
Oct 3, 2023
5199105
Removing unused Gradle build file.
Oct 3, 2023
37020f3
Merge branch 'main' into main
scottgerring Oct 3, 2023
6386358
Adding SAM template so can be used as an existing project and Java ta…
Oct 4, 2023
19679da
Adding SAM template so can be used as an existing project
Oct 4, 2023
17c3a5e
Updating guidance to use SAM for build and deploy
Oct 4, 2023
1312c02
Restructuring separate Java and Kotlin examples.
Oct 4, 2023
18c7f48
Updating core examples readme to represent new structure for Java and…
Oct 4, 2023
d968f3c
Refactoring application code for efficiency, updating build to cover …
Oct 4, 2023
5ce71f7
Updating to fix trailing \n
Oct 4, 2023
35fbbac
Updating guidance to be more specific for examples
Oct 4, 2023
6ffa295
Merge branch 'main' into main
scottgerring Oct 5, 2023
d277c5c
Adopting new mechanism for specifying jvm target.
Oct 6, 2023
6c4646e
accommodating new project structure
Oct 6, 2023
6eecb90
Fixing link typo after refactoring
Oct 6, 2023
66a3dc2
Merge branch 'main' into main
scottgerring Oct 8, 2023
1431899
Setting up Kotlin environment. Converting test to Kotlin.
Oct 2, 2023
3396766
Deploying via SAM successfully.
Oct 2, 2023
baa0e3f
Added Kotlin example.
Oct 3, 2023
16380a8
Removing unused Gradle build file.
Oct 3, 2023
3f3f4e8
Adding SAM template so can be used as an existing project and Java ta…
Oct 4, 2023
9d70b57
Adding SAM template so can be used as an existing project
Oct 4, 2023
bcff275
Updating guidance to use SAM for build and deploy
Oct 4, 2023
84935c9
Restructuring separate Java and Kotlin examples.
Oct 4, 2023
bf6da0d
Updating core examples readme to represent new structure for Java and…
Oct 4, 2023
f67f59a
Refactoring application code for efficiency, updating build to cover …
Oct 4, 2023
f7288d5
Updating to fix trailing \n
Oct 4, 2023
f03b01b
Updating guidance to be more specific for examples
Oct 4, 2023
e523554
Adopting new mechanism for specifying jvm target.
Oct 6, 2023
a71e263
accommodating new project structure
Oct 6, 2023
51fc239
Fixing link typo after refactoring
Oct 6, 2023
6cef711
Flattening structure back to original to make merging easier for v2
Oct 13, 2023
2444ba4
Merge remote-tracking branch 'origin/main'
Oct 13, 2023
c24ee6d
Adding build for Kotlin Gradle
Oct 13, 2023
de19b56
Adding build for Kotlin Gradle - Restructuring Java examples to v1 ap…
Oct 13, 2023
6e23b26
Correcting paths
Oct 13, 2023
480dd8b
Adding SNAPSHOT support and local capability for Maven. Testing using…
Oct 13, 2023
7a8dc16
Reviewed and updated against PR comments.
Oct 20, 2023
de08cbc
Merge branch 'main' into main
scottgerring Oct 23, 2023
bf843a7
Merging with Terraform additions from main branch
Oct 23, 2023
9a154dd
Un-commenting examples
Oct 23, 2023
e3c1cda
Un-commenting examples
Oct 31, 2023
e8ddb45
Adding validation step for IaC SAM
Oct 31, 2023
ec17480
Adding Terraform for Java projects IaC validator and linter
Nov 1, 2023
7d11fac
Adding additional projects for SAM validation and matrix approach
Nov 1, 2023
e932d10
Refactoring stream function to process input logging example with a L…
Nov 17, 2023
ab31b09
Demonstrating Java streaming response
Nov 23, 2023
d4bed89
Refactoring stream function to process input logging example to return
Nov 28, 2023
4322ce9
Update CONTRIBUTING.md
jeromevdl Nov 8, 2023
494d73f
fix: get trace id from system property when env var is not set (#1503)
mriccia Nov 8, 2023
e6e2eb0
fix #1500 (#1506)
jeromevdl Nov 8, 2023
7c51a38
feat: Add support for POWERTOOLS_LOGGER_LOG_EVENT (#1510)
AlexeySoshin Nov 14, 2023
f814d4d
chore: Addition of Warn Message If Invalid Annotation Key While Traci…
jdoherty Nov 14, 2023
9a3a788
feat: ALC (#1514)
jeromevdl Nov 16, 2023
7fc6ff2
chore:Prep release 1.18.0 (#1515)
jeromevdl Nov 16, 2023
6635b50
chore: update version to next snapshot: 1-19.0-SNAPSHOT (#1516)
jeromevdl Nov 16, 2023
9d8b614
Add some more margin to the test pause (#1518)
scottgerring Nov 17, 2023
223d196
test: e2e tests with java 21 (#1517)
jeromevdl Nov 17, 2023
eeaec59
update doc for ALC (#1520)
jeromevdl Nov 20, 2023
150b28f
chore: Testing java21 aspectj pre-release (#1519)
scottgerring Nov 20, 2023
2411a07
chore: Remove build cruft
scottgerring Nov 22, 2023
772b30e
Adding context for using RequestStreamHandler
Nov 29, 2023
c69e3dc
replacing current main version of pr_build
Nov 29, 2023
2259c66
removing pr_lint
Nov 29, 2023
080edc0
Update examples/powertools-examples-core/sam/src/main/java/helloworld…
jasoniharris Dec 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Setting up Kotlin environment. Converting test to Kotlin.
  • Loading branch information
Jason Harris committed Oct 13, 2023
commit 1431899069e8839cb15406ce436017f14b8d2386
38 changes: 38 additions & 0 deletions examples/powertools-examples-core/kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Powertools for AWS Lambda (Java) - Core Utilities Example with Gradle

This project demonstrates the Lambda for Powertools Java module deployed using [Serverless Application Model](https://aws.amazon.com/serverless/sam/) with
[Gradle](https://gradle.org/) running the build. This example is configured for Java 1.8 only; in order to use a newer version, check out the Gradle
configuration guide [in the main project README](../../../README.md).

You can also use `sam init` to create a new Gradle-powered Powertools application - choose to use the **AWS Quick Start Templates**,
and then **Hello World Example with Powertools for AWS Lambda**, **Java 17** runtime, and finally **gradle**.


For general information on the deployed example itself, you can refer to the parent [README](../README.md)

## Configuration
SAM uses [template.yaml](template.yaml) to define the application's AWS resources.
This file defines the Lambda function to be deployed as well as API Gateway for it.

The build of the project is managed by Gradle, and configured in [build.gradle](build.gradle).

## Deploy the sample application
To get started, you can use the Gradle wrapper to bootstrap Gradle and run the build:

```bash
./gradlew build
```

Once this is done to deploy the example, check out the instructions for getting started with SAM in
[the examples directory](../../README.md)

## Additional notes

You can watch the trace information or log information using the SAM CLI:
```bash
# Tail the logs
sam logs --tail $MY_STACK

# Tail the traces
sam traces --tail
```
47 changes: 47 additions & 0 deletions examples/powertools-examples-core/kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

plugins {
id 'java'
id "io.freefair.aspectj.post-compile-weaving" version "6.6.3"
id 'org.jetbrains.kotlin.jvm' version '1.9.10'
}

wrapper {
gradleVersion = "7.6.1"
}

compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"

ajc {
enabled = true
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'com.amazonaws:aws-lambda-java-core:1.2.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
implementation 'com.amazonaws:aws-lambda-java-events:3.11.0'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2'
aspect 'software.amazon.lambda:powertools-tracing:1.17.0'
aspect 'software.amazon.lambda:powertools-logging:1.17.0'
aspect 'software.amazon.lambda:powertools-metrics:1.17.0'
testImplementation 'junit:junit:4.13.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

62 changes: 62 additions & 0 deletions examples/powertools-examples-core/kotlin/events/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"body": "{\"message\": \"hello world\"}",
"resource": "/{proxy+}",
"path": "/path/to/resource",
"httpMethod": "POST",
"isBase64Encoded": false,
"queryStringParameters": {
"foo": "bar"
},
"pathParameters": {
"proxy": "/path/to/resource"
},
"stageVariables": {
"baz": "qux"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, sdch",
"Accept-Language": "en-US,en;q=0.8",
"Cache-Control": "max-age=0",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
"CloudFront-Is-Mobile-Viewer": "false",
"CloudFront-Is-SmartTV-Viewer": "false",
"CloudFront-Is-Tablet-Viewer": "false",
"CloudFront-Viewer-Country": "US",
"Host": "1234567890.execute-api.us-east-1.amazonaws.com",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Custom User Agent String",
"Via": "1.1 08f323deadbeefa7af34d5feb414ce27.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "cDehVQoZnx43VYQb9j2-nvCh-9z396Uhbp027Y2JvkCPNLmGJHqlaA==",
"X-Forwarded-For": "127.0.0.1, 127.0.0.2",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https"
},
"requestContext": {
"accountId": "123456789012",
"resourceId": "123456",
"stage": "prod",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"requestTime": "09/Apr/2015:12:34:56 +0000",
"requestTimeEpoch": 1428582896000,
"identity": {
"cognitoIdentityPoolId": null,
"accountId": null,
"cognitoIdentityId": null,
"caller": null,
"accessKey": null,
"sourceIp": "127.0.0.1",
"cognitoAuthenticationType": null,
"cognitoAuthenticationProvider": null,
"userArn": null,
"userAgent": "Custom User Agent String",
"user": null
},
"path": "/prod/path/to/resource",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"apiId": "1234567890",
"protocol": "HTTP/1.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!gradle-wrapper.jar

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading