Skip to content

Commit

Permalink
Code and lambda functions refactored. cdk-patterns#166
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrodamascena committed Jan 12, 2021
1 parent f487173 commit 816f153
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 313 deletions.
213 changes: 69 additions & 144 deletions the-alexa-skill/python/lambda_fns/lambda.js

Large diffs are not rendered by default.

138 changes: 0 additions & 138 deletions the-alexa-skill/python/lambda_fns/lambda.ts

This file was deleted.

22 changes: 0 additions & 22 deletions the-alexa-skill/python/lambda_fns/package.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
removal_policy=core.RemovalPolicy.DESTROY
)

# install node dependencies for lambdas
lambda_folder = os.path.dirname(os.path.realpath(__file__)) + "/../lambda_fns"
subprocess.check_call("npm i".split(), cwd=lambda_folder, stdout=subprocess.DEVNULL)
subprocess.check_call("npm run build".split(), cwd=lambda_folder, stdout=subprocess.DEVNULL)

# Lambda function for Alexa fulfillment
alexa_lambda = _lambda.Function(self, "AlexaLambdaHandler",
runtime=_lambda.Runtime.NODEJS_12_X,
code=_lambda.Code.from_asset("lambda_fns"),
Expand Down
5 changes: 1 addition & 4 deletions the-alexa-skill/typescript/lib/the-alexa-skill-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@ export class TheAlexaSkillStack extends cdk.Stack {
removalPolicy: cdk.RemovalPolicy.DESTROY
});

// Install Dependencies and Compile Lambda Function
execSync('cd lambda-fns && npm i && npm run build');

// Lambda function for Alexa fulfillment
const alexaLambda = new lambda.Function(this, 'AlexaLambdaHandler', {
runtime: lambda.Runtime.NODEJS_12_X,
code: lambda.Code.asset('lambda-fns'),
code: lambda.Code.fromAsset('lambda-fns'),
handler: 'lambda.handler',
environment: {
USERS_TABLE: usersTable.tableName
Expand Down

0 comments on commit 816f153

Please sign in to comment.