# cdk-lambda-subminute
[![License](https://img.shields.io/badge/License-Apache%202.0-green)](https://opensource.org/licenses/Apache-2.0) [![Release](https://github.com/HsiehShuJeng/cdk-lambda-subminute/workflows/Release/badge.svg)](https://github.com/HsiehShuJeng/cdk-lambda-subminute/actions/workflows/release.yml) [![npm downloads](https://img.shields.io/npm/dt/cdk-lambda-subminute?label=npm%20downloads&style=plastic)](https://img.shields.io/npm/dt/cdk-lambda-subminute?label=npm%20downloads&style=plastic) [![pypi downloads](https://img.shields.io/pypi/dm/cdk-lambda-subminute?label=pypi%20downloads&style=plastic)](https://img.shields.io/pypi/dm/cdk-lambda-subminute?label=pypi%20downloads&style=plastic) [![NuGet downloads](https://img.shields.io/nuget/dt/Lambda.Subminute?label=NuGet%20downloads&style=plastic)](https://img.shields.io/nuget/dt/Lambda.Subminute?label=NuGet%20downloads&style=plastic) [![repo languages](https://img.shields.io/github/languages/count/HsiehShuJeng/cdk-lambda-subminute?style=plastic)](https://img.shields.io/github/languages/count/HsiehShuJeng/cdk-lambda-subminute?style=plastic)
| npm (JS/TS) | PyPI (Python) | Maven (Java) | Go | NuGet |
| --- | --- | --- | --- | --- |
| [Link](https://www.npmjs.com/package/cdk-lambda-subminute) | [Link](https://pypi.org/project/cdk_lambda_subminute/) | [Link](https://search.maven.org/artifact/io.github.hsiehshujeng/cdk-lambda-subminute) | [Link](https://github.com/HsiehShuJeng/cdk-lambda-subminute-go) | [Link](https://www.nuget.org/packages/Lambda.Subminute/) |
This construct creates a state machine that can invoke a Lambda function per time unit which can be less than one minute, such as invoking every 10 seconds. You only need to craft a Lambda function and then assign it as an argument into the construct. An example is included.
# Serverless Architecture
<p align="center"><img src="https://raw.githubusercontent.com/HsiehShuJeng/cdk-lambda-subminute/main/images/cdk_lambda_subminute.png"/></p>
# Introduction
This construct library is reffered to thie AWS Architecture blog post, [*A serverless solution for invoking AWS Lambda at a sub-minute frequency*](https://aws.amazon.com/tw/blogs/architecture/a-serverless-solution-for-invoking-aws-lambda-at-a-sub-minute-frequency/), written by **Emanuele Menga**. I made it as a constrcut library where you only need to care about a target Lambda function, how frequent and how long you want to execute.
# Example
## Typescript
You could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/typescript).
```bash
$ cdk --init language typescript
$ yarn add cdk-lambda-subminute
```
```python
class TypescriptStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const targetLabmda = new Function(this, 'targetFunction', {
code: Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); })'), // It's just a simple function for demonstration purpose only.
functionName: 'testTargetFunction',
runtime: Runtime.NODEJS_18_X,
handler: 'index.handler',
});
const cronJobExample = 'cron(50/1 15-17 ? * SUN-SAT *)';
const subminuteMaster = new LambdaSubminute(this, 'LambdaSubminute', { targetFunction: targetLabmda, cronjobExpression: cronJobExample });
new cdk.CfnOutput(this, 'OStateMachineArn', { value: subminuteMaster.stateMachineArn });
new cdk.CfnOutput(this, 'OIteratorFunctionArn', { value: subminuteMaster.iteratorFunction.functionArn });
}
}
const app = new cdk.App();
new TypescriptStack(app, 'TypescriptStack', {
});
```
## Python
You could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/python).
```bash
# upgrading related Python packages
$ python -m ensurepip --upgrade
$ python -m pip install --upgrade pip
$ python -m pip install --upgrade virtualenv
# initialize a CDK Python project
$ cdk init --language python
# make packages installed locally instead of globally
$ source .venv/bin/activate
$ cat <<EOL > requirements.txt
aws-cdk.core
aws-cdk.aws-lambda
cdk-lambda-subminute
EOL
$ python -m pip install -r requirements.txt
```
```python
from aws_cdk import core as cdk
from aws_cdk.aws_lambda import Code, Function, Runtime
from cdk_lambda_subminute import LambdaSubminute
class PythonStack(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
target_lambda = Function(
self, "targetFunction",
code=Code.from_inline(
"exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); })"),
function_name="testTargetFunction",
runtime=Runtime.NODEJS_18_X,
handler="index.handler"
)
cron_job_example = "cron(10/1 4-5 ? * SUN-SAT *)"
subminute_master = LambdaSubminute(
self, "LambdaSubminute",
target_function=target_lambda,
cronjob_expression=cron_job_example,
frequency=7,
interval_time=8)
cdk.CfnOutput(self, "OStateMachineArn",
value=subminute_master.state_machine_arn)
cdk.CfnOutput(self, "OIteratorFunctionArn",
value=subminute_master.iterator_function.function_arn)
```
```bash
$ deactivate
```
## Java
You could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/java).
```bash
$ cdk init --language java
$ mvn package
```
```xml
.
.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cdk.version>2.149.0</cdk.version>
<constrcut.verion>2.0.442</constrcut.verion>
<junit.version>5.7.1</junit.version>
</properties>
.
.
<dependencies>
<!-- AWS Cloud Development Kit -->
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>core</artifactId>
<version>${cdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>lambda</artifactId>
<version>${cdk.version}</version>
</dependency>
<dependency>
<groupId>io.github.hsiehshujeng</groupId>
<artifactId>cdk-lambda-subminute</artifactId>
<version>${constrcut.verion}</version>
</dependency>
.
.
.
</dependencies>
```
```java
package com.myorg;
import software.amazon.awscdk.core.CfnOutput;
import software.amazon.awscdk.core.CfnOutputProps;
import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import software.amazon.awscdk.services.lambda.Code;
import software.amazon.awscdk.services.lambda.Function;
import software.amazon.awscdk.services.lambda.FunctionProps;
import software.amazon.awscdk.services.lambda.Runtime;
import io.github.hsiehshujeng.cdk.lambda.subminute.LambdaSubminute;
import io.github.hsiehshujeng.cdk.lambda.subminute.LambdaSubminuteProps;
public class JavaStack extends Stack {
public JavaStack(final Construct scope, final String id) {
this(scope, id, null);
}
public JavaStack(final Construct scope, final String id, final StackProps props) {
super(scope, id, props);
Function targetLambda = new Function(this, "targetFunction",
FunctionProps.builder()
.code(Code.fromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); })"))
.functionName("estTargetFunction")
.runtime(Runtime.NODEJS_18_X)
.handler("index.handler")
.build());
String cronJobExample = "cron(50/1 4-5 ? * SUN-SAT *)";
LambdaSubminute subminuteMaster = new LambdaSubminute(this, "LambdaSubminute", LambdaSubminuteProps.builder()
.targetFunction(targetLambda)
.cronjobExpression(cronJobExample)
.frequency(6)
.intervalTime(9)
.build());
new CfnOutput(this, "OStateMachineArn",
CfnOutputProps.builder()
.value(subminuteMaster.getStateMachineArn())
.build());
new CfnOutput(this, "OIteratorFunctionArn",
CfnOutputProps.builder()
.value(subminuteMaster.getIteratorFunction().getFunctionName())
.build());
}
}
```
## C#
You could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/csharp).
```bash
$ cdk init --language csharp
$ dotnet add src/Csharp package Amazon.CDK.AWS.Lambda
$ dotnet add src/Csharp package Lambda.Subminute --version 2.0.442
```
```cs
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
using ScottHsieh.Cdk;
namespace Csharp
{
public class CsharpStack : Stack
{
internal CsharpStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
var targetLambda = new Function(this, "targetFunction", new FunctionProps
{
Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); })"),
FunctionName = "testTargetFunction",
Runtime = Runtime.NODEJS_18_X,
Handler = "index.handler"
});
string cronJobExample = "cron(50/1 6-7 ? * SUN-SAT *)";
var subminuteMaster = new LambdaSubminute(this, "LambdaSubminute", new LambdaSubminuteProps
{
TargetFunction = targetLambda,
CronjobExpression = cronJobExample,
Frequency = 10,
IntervalTime = 6,
});
new CfnOutput(this, "OStateMachineArn", new CfnOutputProps
{
Value = subminuteMaster.StateMachineArn
});
new CfnOutput(this, "OIteratorFunctionArn", new CfnOutputProps
{
Value = subminuteMaster.IteratorFunction.FunctionArn
});
}
}
}
```
## GO
```bash
# Initialize a new AWS CDK application in the current directory with the Go programming language
cdk init app -l go
# Add this custom CDK construct to your project
go get github.com/HsiehShuJeng/cdk-lambda-subminute-go/cdklambdasubminute/v2@v2.0.442
# Ensure all dependencies are properly listed in the go.mod file and remove any unused ones
go mod tidy
# Upgrade all Go modules in your project to their latest minor or patch versions
go get -u ./...
```
# Statemachine Diagram
![image](https://raw.githubusercontent.com/HsiehShuJeng/cdk-lambda-subminute/main/images/statemachine_diagram.png)
# Known issue
Originally, I utilized `PythonFuncion` in the module of [**@aws-cdk/aws-lambda-python**](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-python-readme.html) to build the iterator Lambda function. Every thing works fine, including test, on my local machine (MacBook Pro M1), until it comes to the CI in Github Actions, it awlays gave me the following message:
```bash
## cdk version: 1.105.0 (build 4813992)
Bundling did not produce any output. Check that content is written to /asset-output.
64 | }));
65 |
> 66 | this.function = new PythonFunction(this, 'Iterator', {
| ^
67 | functionName: 'lambda-subminute-iterator',
68 | description: 'A function for breaking the limit of 1 minute with the CloudWatch Rules.',
69 | logRetention: RetentionDays.THREE_MONTHS,
at AssetStaging.bundle (node_modules/@aws-cdk/core/lib/asset-staging.ts:484:13)
at AssetStaging.stageByBundling (node_modules/@aws-cdk/core/lib/asset-staging.ts:328:10)
at stageThisAsset (node_modules/@aws-cdk/core/lib/asset-staging.ts:194:35)
at Cache.obtain (node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)
at new AssetStaging (node_modules/@aws-cdk/core/lib/asset-staging.ts:219:44)
at new Asset (node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:127:21)
at AssetCode.bind (node_modules/@aws-cdk/aws-lambda/lib/code.ts:277:20)
at new Function (node_modules/@aws-cdk/aws-lambda/lib/function.ts:583:29)
at new PythonFunction (node_modules/@aws-cdk/aws-lambda-python/lib/function.ts:106:5)
at new IteratorLambda (src/cdk-lambda-subminute.ts:66:21)
at new LambdaSubminute (src/cdk-lambda-subminute.ts:25:22)
at Object.<anonymous>.test (test/integ.test.ts:23:3)
```
I actually have tried many different methods according to the following threads but to no avail. I'll attempt to test some thoughts or just post the issue onto the CDK Github repo.
* [Asset Bundling](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-assets-readme.html#asset-bundling)
* [Change the bundler's /asset-output local volume mount location #8589](https://github.com/aws/aws-cdk/issues/8589)
* [(aws-lambda-python: PythonFunction): unable to use bundling in BitBucket #14156](https://github.com/aws/aws-cdk/issues/14516)
* [BundlingDockerImage.cp() needs to be explained more in the README #11914](https://github.com/aws/aws-cdk/issues/11914)
Raw data
{
"_id": null,
"home_page": "https://github.com/HsiehShuJeng/cdk-lambda-subminute.git",
"name": "cdk-lambda-subminute",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Shu-Jeng Hsieh",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/3d/59/e6fd3fe968e0d6cdf22caf6034cc6594f63e1c3909486acb94623851a252/cdk_lambda_subminute-2.0.566.tar.gz",
"platform": null,
"description": "# cdk-lambda-subminute\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-green)](https://opensource.org/licenses/Apache-2.0) [![Release](https://github.com/HsiehShuJeng/cdk-lambda-subminute/workflows/Release/badge.svg)](https://github.com/HsiehShuJeng/cdk-lambda-subminute/actions/workflows/release.yml) [![npm downloads](https://img.shields.io/npm/dt/cdk-lambda-subminute?label=npm%20downloads&style=plastic)](https://img.shields.io/npm/dt/cdk-lambda-subminute?label=npm%20downloads&style=plastic) [![pypi downloads](https://img.shields.io/pypi/dm/cdk-lambda-subminute?label=pypi%20downloads&style=plastic)](https://img.shields.io/pypi/dm/cdk-lambda-subminute?label=pypi%20downloads&style=plastic) [![NuGet downloads](https://img.shields.io/nuget/dt/Lambda.Subminute?label=NuGet%20downloads&style=plastic)](https://img.shields.io/nuget/dt/Lambda.Subminute?label=NuGet%20downloads&style=plastic) [![repo languages](https://img.shields.io/github/languages/count/HsiehShuJeng/cdk-lambda-subminute?style=plastic)](https://img.shields.io/github/languages/count/HsiehShuJeng/cdk-lambda-subminute?style=plastic)\n\n| npm (JS/TS) | PyPI (Python) | Maven (Java) | Go | NuGet |\n| --- | --- | --- | --- | --- |\n| [Link](https://www.npmjs.com/package/cdk-lambda-subminute) | [Link](https://pypi.org/project/cdk_lambda_subminute/) | [Link](https://search.maven.org/artifact/io.github.hsiehshujeng/cdk-lambda-subminute) | [Link](https://github.com/HsiehShuJeng/cdk-lambda-subminute-go) | [Link](https://www.nuget.org/packages/Lambda.Subminute/) |\n\nThis construct creates a state machine that can invoke a Lambda function per time unit which can be less than one minute, such as invoking every 10 seconds. You only need to craft a Lambda function and then assign it as an argument into the construct. An example is included.\n\n# Serverless Architecture\n\n<p align=\"center\"><img src=\"https://raw.githubusercontent.com/HsiehShuJeng/cdk-lambda-subminute/main/images/cdk_lambda_subminute.png\"/></p>\n\n# Introduction\n\nThis construct library is reffered to thie AWS Architecture blog post, [*A serverless solution for invoking AWS Lambda at a sub-minute frequency*](https://aws.amazon.com/tw/blogs/architecture/a-serverless-solution-for-invoking-aws-lambda-at-a-sub-minute-frequency/), written by **Emanuele Menga**. I made it as a constrcut library where you only need to care about a target Lambda function, how frequent and how long you want to execute.\n\n# Example\n\n## Typescript\n\nYou could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/typescript).\n\n```bash\n$ cdk --init language typescript\n$ yarn add cdk-lambda-subminute\n```\n\n```python\nclass TypescriptStack extends cdk.Stack {\n constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {\n super(scope, id, props);\n\n const targetLabmda = new Function(this, 'targetFunction', {\n code: Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); })'), // It's just a simple function for demonstration purpose only.\n functionName: 'testTargetFunction',\n runtime: Runtime.NODEJS_18_X,\n handler: 'index.handler',\n });\n const cronJobExample = 'cron(50/1 15-17 ? * SUN-SAT *)';\n const subminuteMaster = new LambdaSubminute(this, 'LambdaSubminute', { targetFunction: targetLabmda, cronjobExpression: cronJobExample });\n\n new cdk.CfnOutput(this, 'OStateMachineArn', { value: subminuteMaster.stateMachineArn });\n new cdk.CfnOutput(this, 'OIteratorFunctionArn', { value: subminuteMaster.iteratorFunction.functionArn });\n }\n}\n\nconst app = new cdk.App();\nnew TypescriptStack(app, 'TypescriptStack', {\n});\n```\n\n## Python\n\nYou could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/python).\n\n```bash\n# upgrading related Python packages\n$ python -m ensurepip --upgrade\n$ python -m pip install --upgrade pip\n$ python -m pip install --upgrade virtualenv\n# initialize a CDK Python project\n$ cdk init --language python\n# make packages installed locally instead of globally\n$ source .venv/bin/activate\n$ cat <<EOL > requirements.txt\naws-cdk.core\naws-cdk.aws-lambda\ncdk-lambda-subminute\nEOL\n$ python -m pip install -r requirements.txt\n```\n\n```python\nfrom aws_cdk import core as cdk\nfrom aws_cdk.aws_lambda import Code, Function, Runtime\nfrom cdk_lambda_subminute import LambdaSubminute\n\nclass PythonStack(cdk.Stack):\n def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:\n super().__init__(scope, construct_id, **kwargs)\n\n target_lambda = Function(\n self, \"targetFunction\",\n code=Code.from_inline(\n \"exports.handler = function(event, ctx, cb) { return cb(null, \\\"hi\\\"); })\"),\n function_name=\"testTargetFunction\",\n runtime=Runtime.NODEJS_18_X,\n handler=\"index.handler\"\n )\n cron_job_example = \"cron(10/1 4-5 ? * SUN-SAT *)\"\n subminute_master = LambdaSubminute(\n self, \"LambdaSubminute\",\n target_function=target_lambda,\n cronjob_expression=cron_job_example,\n frequency=7,\n interval_time=8)\n\n cdk.CfnOutput(self, \"OStateMachineArn\",\n value=subminute_master.state_machine_arn)\n cdk.CfnOutput(self, \"OIteratorFunctionArn\",\n value=subminute_master.iterator_function.function_arn)\n```\n\n```bash\n$ deactivate\n```\n\n## Java\n\nYou could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/java).\n\n```bash\n$ cdk init --language java\n$ mvn package\n```\n\n```xml\n.\n.\n<properties>\n <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n <cdk.version>2.149.0</cdk.version>\n <constrcut.verion>2.0.442</constrcut.verion>\n <junit.version>5.7.1</junit.version>\n</properties>\n .\n .\n <dependencies>\n <!-- AWS Cloud Development Kit -->\n <dependency>\n <groupId>software.amazon.awscdk</groupId>\n <artifactId>core</artifactId>\n <version>${cdk.version}</version>\n </dependency>\n <dependency>\n <groupId>software.amazon.awscdk</groupId>\n <artifactId>lambda</artifactId>\n <version>${cdk.version}</version>\n </dependency>\n <dependency>\n <groupId>io.github.hsiehshujeng</groupId>\n <artifactId>cdk-lambda-subminute</artifactId>\n <version>${constrcut.verion}</version>\n </dependency>\n .\n .\n .\n </dependencies>\n```\n\n```java\npackage com.myorg;\n\nimport software.amazon.awscdk.core.CfnOutput;\nimport software.amazon.awscdk.core.CfnOutputProps;\nimport software.amazon.awscdk.core.Construct;\nimport software.amazon.awscdk.core.Stack;\nimport software.amazon.awscdk.core.StackProps;\nimport software.amazon.awscdk.services.lambda.Code;\nimport software.amazon.awscdk.services.lambda.Function;\nimport software.amazon.awscdk.services.lambda.FunctionProps;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport io.github.hsiehshujeng.cdk.lambda.subminute.LambdaSubminute;\nimport io.github.hsiehshujeng.cdk.lambda.subminute.LambdaSubminuteProps;\n\npublic class JavaStack extends Stack {\n public JavaStack(final Construct scope, final String id) {\n this(scope, id, null);\n }\n\n public JavaStack(final Construct scope, final String id, final StackProps props) {\n super(scope, id, props);\n\n Function targetLambda = new Function(this, \"targetFunction\",\n FunctionProps.builder()\n .code(Code.fromInline(\"exports.handler = function(event, ctx, cb) { return cb(null, \\\"hi\\\"); })\"))\n .functionName(\"estTargetFunction\")\n .runtime(Runtime.NODEJS_18_X)\n .handler(\"index.handler\")\n .build());\n String cronJobExample = \"cron(50/1 4-5 ? * SUN-SAT *)\";\n LambdaSubminute subminuteMaster = new LambdaSubminute(this, \"LambdaSubminute\", LambdaSubminuteProps.builder()\n .targetFunction(targetLambda)\n .cronjobExpression(cronJobExample)\n .frequency(6)\n .intervalTime(9)\n .build());\n\n new CfnOutput(this, \"OStateMachineArn\",\n CfnOutputProps.builder()\n .value(subminuteMaster.getStateMachineArn())\n .build());\n new CfnOutput(this, \"OIteratorFunctionArn\",\n CfnOutputProps.builder()\n .value(subminuteMaster.getIteratorFunction().getFunctionName())\n .build());\n }\n}\n\n```\n\n## C#\n\nYou could also refer to [here](https://github.com/HsiehShuJeng/cdk-lambda-subminute/tree/main/src/demo/csharp).\n\n```bash\n$ cdk init --language csharp\n$ dotnet add src/Csharp package Amazon.CDK.AWS.Lambda\n$ dotnet add src/Csharp package Lambda.Subminute --version 2.0.442\n```\n\n```cs\nusing Amazon.CDK;\nusing Amazon.CDK.AWS.Lambda;\nusing ScottHsieh.Cdk;\n\nnamespace Csharp\n{\n public class CsharpStack : Stack\n {\n internal CsharpStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)\n {\n var targetLambda = new Function(this, \"targetFunction\", new FunctionProps\n {\n Code = Code.FromInline(\"exports.handler = function(event, ctx, cb) { return cb(null, \\\"hi\\\"); })\"),\n FunctionName = \"testTargetFunction\",\n Runtime = Runtime.NODEJS_18_X,\n Handler = \"index.handler\"\n });\n string cronJobExample = \"cron(50/1 6-7 ? * SUN-SAT *)\";\n var subminuteMaster = new LambdaSubminute(this, \"LambdaSubminute\", new LambdaSubminuteProps\n {\n TargetFunction = targetLambda,\n CronjobExpression = cronJobExample,\n Frequency = 10,\n IntervalTime = 6,\n });\n\n new CfnOutput(this, \"OStateMachineArn\", new CfnOutputProps\n {\n Value = subminuteMaster.StateMachineArn\n });\n new CfnOutput(this, \"OIteratorFunctionArn\", new CfnOutputProps\n {\n Value = subminuteMaster.IteratorFunction.FunctionArn\n });\n }\n }\n}\n```\n\n## GO\n\n```bash\n# Initialize a new AWS CDK application in the current directory with the Go programming language\ncdk init app -l go\n# Add this custom CDK construct to your project\ngo get github.com/HsiehShuJeng/cdk-lambda-subminute-go/cdklambdasubminute/v2@v2.0.442\n# Ensure all dependencies are properly listed in the go.mod file and remove any unused ones\ngo mod tidy\n# Upgrade all Go modules in your project to their latest minor or patch versions\ngo get -u ./...\n```\n\n# Statemachine Diagram\n\n![image](https://raw.githubusercontent.com/HsiehShuJeng/cdk-lambda-subminute/main/images/statemachine_diagram.png)\n\n# Known issue\n\nOriginally, I utilized `PythonFuncion` in the module of [**@aws-cdk/aws-lambda-python**](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-python-readme.html) to build the iterator Lambda function. Every thing works fine, including test, on my local machine (MacBook Pro M1), until it comes to the CI in Github Actions, it awlays gave me the following message:\n\n```bash\n## cdk version: 1.105.0 (build 4813992)\nBundling did not produce any output. Check that content is written to /asset-output.\n\n 64 | }));\n 65 |\n > 66 | this.function = new PythonFunction(this, 'Iterator', {\n | ^\n 67 | functionName: 'lambda-subminute-iterator',\n 68 | description: 'A function for breaking the limit of 1 minute with the CloudWatch Rules.',\n 69 | logRetention: RetentionDays.THREE_MONTHS,\n\n at AssetStaging.bundle (node_modules/@aws-cdk/core/lib/asset-staging.ts:484:13)\n at AssetStaging.stageByBundling (node_modules/@aws-cdk/core/lib/asset-staging.ts:328:10)\n at stageThisAsset (node_modules/@aws-cdk/core/lib/asset-staging.ts:194:35)\n at Cache.obtain (node_modules/@aws-cdk/core/lib/private/cache.ts:24:13)\n at new AssetStaging (node_modules/@aws-cdk/core/lib/asset-staging.ts:219:44)\n at new Asset (node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:127:21)\n at AssetCode.bind (node_modules/@aws-cdk/aws-lambda/lib/code.ts:277:20)\n at new Function (node_modules/@aws-cdk/aws-lambda/lib/function.ts:583:29)\n at new PythonFunction (node_modules/@aws-cdk/aws-lambda-python/lib/function.ts:106:5)\n at new IteratorLambda (src/cdk-lambda-subminute.ts:66:21)\n at new LambdaSubminute (src/cdk-lambda-subminute.ts:25:22)\n at Object.<anonymous>.test (test/integ.test.ts:23:3)\n```\n\nI actually have tried many different methods according to the following threads but to no avail. I'll attempt to test some thoughts or just post the issue onto the CDK Github repo.\n\n* [Asset Bundling](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-assets-readme.html#asset-bundling)\n* [Change the bundler's /asset-output local volume mount location #8589](https://github.com/aws/aws-cdk/issues/8589)\n* [(aws-lambda-python: PythonFunction): unable to use bundling in BitBucket #14156](https://github.com/aws/aws-cdk/issues/14516)\n* [BundlingDockerImage.cp() needs to be explained more in the README #11914](https://github.com/aws/aws-cdk/issues/11914)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A construct for deploying a Lambda function that can be invoked every time unit less than one minute.",
"version": "2.0.566",
"project_urls": {
"Homepage": "https://github.com/HsiehShuJeng/cdk-lambda-subminute.git",
"Source": "https://github.com/HsiehShuJeng/cdk-lambda-subminute.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0dfd6e9cc535ee65db8e30906dde930b474b373c5c02c6cfeb6fa45989366c45",
"md5": "f3df90330f7fa014da181640374d4e26",
"sha256": "4684157c270a8fceecf6ddfc0e9deb3bb4ec8956e47bad0cc53b5d76857bd357"
},
"downloads": -1,
"filename": "cdk_lambda_subminute-2.0.566-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f3df90330f7fa014da181640374d4e26",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 13142553,
"upload_time": "2024-12-22T01:30:39",
"upload_time_iso_8601": "2024-12-22T01:30:39.845110Z",
"url": "https://files.pythonhosted.org/packages/0d/fd/6e9cc535ee65db8e30906dde930b474b373c5c02c6cfeb6fa45989366c45/cdk_lambda_subminute-2.0.566-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3d59e6fd3fe968e0d6cdf22caf6034cc6594f63e1c3909486acb94623851a252",
"md5": "d43eb91a7d173ac6ba01f55bc6f83b41",
"sha256": "8b4dbb9c040ff062ce9ee0965210c2b94aef202bf74f1ed5ce9ba8a6d25c2602"
},
"downloads": -1,
"filename": "cdk_lambda_subminute-2.0.566.tar.gz",
"has_sig": false,
"md5_digest": "d43eb91a7d173ac6ba01f55bc6f83b41",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 13143968,
"upload_time": "2024-12-22T01:30:44",
"upload_time_iso_8601": "2024-12-22T01:30:44.760271Z",
"url": "https://files.pythonhosted.org/packages/3d/59/e6fd3fe968e0d6cdf22caf6034cc6594f63e1c3909486acb94623851a252/cdk_lambda_subminute-2.0.566.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 01:30:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HsiehShuJeng",
"github_project": "cdk-lambda-subminute",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cdk-lambda-subminute"
}