James
01/25/2022, 1:58 PMDan Van Brunt
01/25/2022, 2:03 PMapplyRemovalPolicy(cdk.RemovalPolicy.RETAIN)
to inline policies on a role?
roleCleanup.addToPolicy(
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['events:DeleteRule'],
resources: [ cronCleanupArn ],
}),
)
Adie Williams
01/25/2022, 3:34 PMMismatched versions of AWS CDK packages. Serverless Stack currently supports 2.7.0. Fix using:
npm install @aws-cdk/aws-chatbot@2.7.0 @aws-cdk/aws-cloudwatch@2.7.0 @aws-cdk/aws-cloudwatch-actions@2.7.0 @aws-cdk/aws-sns@2.7.0 --save-exact
Learn more about it here — <https://github.com/serverless-stack/serverless-stack#cdk-version-mismatch>
but this error persists after running npx sst add-cdk @aws-cdk/aws-chatbot@2.7.0 @aws-cdk/aws-cloudwatch@2.7.0 @aws-cdk/aws-cloudwatch-actions@2.7.0 @aws-cdk/aws-sns@2.7.0
which opens an interactive mode as these versions don’t exist. Does anyone have any ideas of how I can resolve this?David Garcia
01/25/2022, 4:14 PMPiers Williams
01/25/2022, 5:02 PMsst deploy
on an EC2 instance as part of our build pipeline, and having problems getting it to use an AWS_PROFILE that resides in another account. In ~/.aws/config
the profile looks like so:
[profile sandbox]
role_arn = arn:aws:iam.../SandboxAdmin
region = eu-west-2
credential_source = Ec2InstanceMetadata
and the pipeline just tries to run AWS_PROFILE=sandbox sst deploy --stage test
, but the error I get is:
reparing your SST app
Deploying stacks
AccessDenied: User: arn:aws:sts::035571076409:assumed-role/GitlabRunner/i-0da27111607bdae26 is not authorized to perform: cloudformation:DescribeStacks on resource: arn:aws:cloudformation:eu-west-2:... because no identity-based policy allows the cloudformation:DescribeStacks action
Adam Fanello
01/25/2022, 6:20 PMsst build
outputs Run npx sst deploy to deploy to AWS.
? It sometimes hangs there instead of exiting.Sam Hulick
01/25/2022, 6:46 PMenableLiveDev
is enabled for that function? through some sort of env var maybe?Mischa Spiegelmock
01/25/2022, 7:05 PMMichael Robellard
01/25/2022, 10:13 PMMarko Bilal
01/25/2022, 10:42 PMResource handler returned message: "Uploaded file must be a non-empty zip
after i have been deploying non stop for the last 5 daysKristian Lake
01/25/2022, 11:21 PMYap Yee Qiang
01/26/2022, 5:23 AMREVIEW_IN_PROGRESS
, how do I make it available and ready to be used?Linh Duy
01/26/2022, 12:34 PMJosimar Zimermann
01/26/2022, 12:52 PMAdie Williams
01/26/2022, 1:36 PMnextjsSite
construct and it works like a charm, the problem I’m facing is adding Cloudwatch alarms to the lambda’s this construct creates. My assumption was that getAllFunctions
would help here but the construct doesn’t return this method and using it as I have below doesn’t return any functions. Any suggestions would be great.
// js
import * as sst from "@serverless-stack/resources";
import * as CDK from "aws-cdk-lib";
import * as cloudwatch from "aws-cdk-lib/aws-cloudwatch";
import * as cw_actions from "aws-cdk-lib/aws-cloudwatch-actions";
import * as sns from "aws-cdk-lib/aws-sns";
import * as chatbot from "aws-cdk-lib/aws-chatbot";
export default class BrandStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
const site = new sst.NextjsSite(this, props.brand, {
path: "./",
environment: {
NEXT_PUBLIC_BRAND: props.brand,
},
});
// Get all functions created by the NextjsSite construct
const functions = this.getAllFunctions();
// Add metric and alarm for each lambda to catch errors
functions.forEach((fn) => {
const fnName = fn.functionName || "lambda";
// Configure metric for errors
const fnErrors = fn.metricErrors({
period: CDK.Duration.minutes(1),
});
// configure alarm
new cloudwatch.Alarm(this, `${fnName}-errors-alarm"}`, {
metric: fnErrors,
threshold: 1,
comparisonOperator:
cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
evaluationPeriods: 1,
alarmDescription: `Errors for ${fnName}`,
});
// Send alert
const topic = new sns.Topic(this, `${fnName}-Topic`);
cloudwatch.Alarm.addAlarmAction(new cw_actions.SnsAction(topic));
// Configure slack connection
new chatbot.SlackChannelConfiguration(this, `${fnName}-SlackChannel`, {
slackChannelConfigurationName: "sites-alerts-dev",
slackChannelId: "C02VD7K1X6G",
slackWorkspaceId: "T52H878E7",
notificationTopics: [topic],
loggingLevel: chatbot.LoggingLevel.ERROR,
});
});
this.addOutputs({
URL: site.url,
});
}
}
Gerald
01/26/2022, 2:17 PMJon Holman
01/26/2022, 5:09 PMsst deploy
is run? I would like to be able to prompt for parameters if they were not provided through arguments / env file. For example if I wanted to create a project that would use an existing s3 bucket (if the user wants) but otherwise will create its own bucket.Nick Laffey
01/26/2022, 5:21 PMDaniel Gato
01/26/2022, 5:39 PM0.57.0
to 0.59.1
SST feels not stable.
Just right now we added this to our storage stack:
indexProps: {
nonKeyAttributes: ['description', 'publishedAt'],
projectionType: ProjectionType.INCLUDE
}
The file .build/cdk.out/dev-xx-storage-template.json
went from
"Projection": {
"ProjectionType": "ALL"
}
to
"Projection": {
"NonKeyAttributes": [
"description",
"publishedAt"
],
"ProjectionType": "INCLUDE"
}
But in the console I still always get:
Stacks: Synthesizing changes...
Successfully synthesized to /Users/daniel/Github/xx/.build/cdk.out
Stacks: No changes to deploy.
On AWS I can see that my table is still with Projected Attributes ALL
.
Am I missing something here?Devin
01/26/2022, 6:11 PMBshr Ramadan
01/26/2022, 7:01 PMDavid Garcia
01/26/2022, 9:19 PMSam Hulick
01/26/2022, 9:47 PMMartin Wawrusch
01/26/2022, 10:37 PMThomas Ankcorn
01/26/2022, 10:50 PM.sst/artifacts/99a3edf9/src/lambda.handler is undefined or not exported
Adam Fanello
01/27/2022, 12:46 AMAdam Fanello
01/27/2022, 1:55 AMScript
receives bootstrapThingPolicy
as a parameter, but upon removing the stack CloudFormation immediately tries to delete BootstrapThingPolicy
, before running the onDelete
script.
const bootstrapThingPolicy = new CfnPolicy(this, "BootstrapThingPolicy", {
policyName: scope.logicalPrefixedName("bootstrap-thing-policy"),
policyDocument: bootstrapThingPolicyDocument,
});
const namespace = scope.logicalPrefixedName("").slice(0, -1);
new Script(this, "bootstrap", {
defaultFunctionProps: {
timeout: 60,
memorySize: 128,
permissions: toPermissions(
new statement.Iot()
.allow()
.toAttachPolicy()
.toAttachThingPrincipal()
.toCreateKeysAndCertificate()
.toCreateThing()
.toDeleteCertificate()
.toDeleteThing()
.toDescribeEndpoint()
.toDescribeThing()
.toDetachPolicy()
.toDetachThingPrincipal()
.toListPrincipalPolicies()
.toListThingPrincipals()
.toUpdateCertificate()
.onAllResources(),
new statement.Ssm().allow().toDeleteParameter().toPutParameter().onAllResources()
),
logRetention: RetentionDays.ONE_MONTH,
},
params: {
namespace,
boostrapThingPolicyName: bootstrapThingPolicy.policyName,
},
onCreate: "src/stacks/iot-provisioning/bootstrap-cert-script.onCreate",
onDelete: "src/stacks/iot-provisioning/bootstrap-cert-script.onDelete",
});
}
koukito
01/27/2022, 11:35 AMAlexey Gonchar
01/27/2022, 11:38 AMserverless framework
via seed? I didn't found anything similar except unanswered question in this thread 🤔
If question about seed doesn't belong to this channel, pls give me a signal(Albert
01/27/2022, 12:03 PM