-
Notifications
You must be signed in to change notification settings - Fork 820
feat(gen2-migration): kinesis triggers codegen for gen2-migration #14787
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
iliapolo
merged 5 commits into
gen2-migration
from
sai/kinesis-triggers-codegen-for-gen2migration
Apr 16, 2026
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2552a31
feat(cli-internal): add kinesis stream trigger codegen for gen2-migra…
sai-ray 75d88b0
refactor(cli-internal): rename kinesis trigger function to moodboardK…
sai-ray be33ecf
fix(cli-internal): update mood-board snapshot expectations
sai-ray 070dcaa
fix(cli-internal): prefix unused loop variable with underscore
sai-ray 799f215
fix(cli-internal): remove unnecessary directory guard in configure.sh
sai-ray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...ps/mood-board/_snapshot.post.generate/amplify/function/moodboardKinesisTrigger/event.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "key1": "value1", | ||
| "key2": "value2", | ||
| "key3": "value3" | ||
| } |
65 changes: 65 additions & 0 deletions
65
...apps/mood-board/_snapshot.post.generate/amplify/function/moodboardKinesisTrigger/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* Amplify Params - DO NOT EDIT | ||
| API_MOODBOARD_GRAPHQLAPIENDPOINTOUTPUT | ||
| API_MOODBOARD_GRAPHQLAPIIDOUTPUT | ||
| API_MOODBOARD_GRAPHQLAPIKEYOUTPUT | ||
| ANALYTICS_MOODBOARDKINESIS_KINESISSTREAMARN | ||
| ENV | ||
| REGION | ||
| Amplify Params - DO NOT EDIT */ | ||
|
|
||
| const https = require('https'); | ||
| const url = require('url'); | ||
|
|
||
| const GRAPHQL_ENDPOINT = process.env.API_MOODBOARD_GRAPHQLAPIENDPOINTOUTPUT; | ||
| const API_KEY = process.env.API_MOODBOARD_GRAPHQLAPIKEYOUTPUT; | ||
|
|
||
| const createKinesisEventCount = /* GraphQL */ ` | ||
| mutation CreateKinesisEventCount($input: CreateKinesisEventCountInput!) { | ||
| createKinesisEventCount(input: $input) { | ||
| id | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| function graphqlRequest(query, variables) { | ||
| const endpoint = url.parse(GRAPHQL_ENDPOINT); | ||
| const body = JSON.stringify({ query, variables }); | ||
|
|
||
| return new Promise((resolve, reject) => { | ||
| const req = https.request( | ||
| { | ||
| hostname: endpoint.hostname, | ||
| path: endpoint.path, | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'x-api-key': API_KEY, | ||
| 'Content-Length': Buffer.byteLength(body), | ||
| }, | ||
| }, | ||
| (res) => { | ||
| let data = ''; | ||
| res.on('data', (chunk) => (data += chunk)); | ||
| res.on('end', () => resolve(JSON.parse(data))); | ||
| }, | ||
| ); | ||
| req.on('error', reject); | ||
| req.write(body); | ||
| req.end(); | ||
| }); | ||
| } | ||
|
|
||
| exports.handler = async (event) => { | ||
| console.log('Kinesis trigger fired with', event.Records.length, 'records'); | ||
|
|
||
| for (const record of event.Records) { | ||
Check failureCode scanning / CodeQL Unused loop iteration variable Error
For loop variable record is not used in the loop body.
Check noticeCode scanning / CodeQL Unused variable, import, function or class Note
Unused variable record.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| await graphqlRequest(createKinesisEventCount, { | ||
| input: { | ||
| processedAt: new Date().toISOString(), | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| console.log('Logged', event.Records.length, 'events'); | ||
| return { statusCode: 200 }; | ||
| }; | ||
12 changes: 12 additions & 0 deletions
12
...s/mood-board/_snapshot.post.generate/amplify/function/moodboardKinesisTrigger/resource.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { defineFunction } from '@aws-amplify/backend'; | ||
|
|
||
| const branchName = process.env.AWS_BRANCH ?? 'sandbox'; | ||
|
|
||
| export const moodboardKinesisTrigger = defineFunction({ | ||
| entry: './index.js', | ||
| name: `moodboardKinesisTrigger-${branchName}`, | ||
| timeoutSeconds: 25, | ||
| memoryMB: 128, | ||
| environment: { ENV: `${branchName}`, REGION: 'us-east-1' }, | ||
| runtime: 22, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.