Pål Brattberg
03/30/2021, 5:43 PM'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: `services/${id}/timer.opt2`, timeout: 15 }
Of course, that's (mostly) wrong and will ignore the timeout. Now it's defined like this and all is well:
'GET /myroute': { authorizationType: sst.ApiAuthorizationType.NONE, function: { handler: `services/${id}/timer.opt2`, timeout: 15 } }
Tyler Flint
03/31/2021, 3:16 AMthdxr
03/31/2021, 2:00 PMgo env GOCACHE
thdxr
03/31/2021, 2:01 PMTyler Flint
03/31/2021, 3:08 PMcdk
instead of lib
. Is it possible to change the location?Mike McCall
04/01/2021, 4:59 AMJesse Wynants
04/01/2021, 7:20 PMTyler Flint
04/02/2021, 1:19 PMsst start
? I’ve already disabled bundling which works for deploy, but during sst start
it still runs everything through esbuild which messes with my source map. (This is an existing app with a complex webpack config, so I webpack build first, then point the function to the result).Tyler Flint
04/02/2021, 2:42 PMbundle: false
doesn’t actually stop esbuild from building even for deploy.Tyler Flint
04/02/2021, 6:18 PMRoss Coundon
04/03/2021, 6:54 AMRoss Coundon
04/06/2021, 2:02 PMDennis Dang
04/06/2021, 5:29 PMthdxr
04/11/2021, 1:07 AMthdxr
04/11/2021, 1:11 AMMike McCall
04/12/2021, 3:46 PMJakob Fix
04/12/2021, 9:28 PMApi
or Cron
constructs, for example) while running npx sst start
I get this message Detected a change in your CDK constructs. Restart the debugger to deploy the changes.
which is cool. But is there a more straight-forward way than Ctrl-c
+ npx sst start
? I remember that nodemon
I think has the rs
command that I can type to restart the process. Anything you would consider to further improve the developer experience? (It’s only a tiny niggle, no worries). Or is there already something similar maybe? 🙏Mike McCall
04/12/2021, 10:49 PMMatthew Purdon
04/14/2021, 5:44 PMthdxr
04/15/2021, 4:49 AMthdxr
04/15/2021, 4:50 AMRoss Coundon
04/19/2021, 8:08 PMAuthorization type is set to NONE which is different from what is required by the authorizer [CUSTOM]
My definition looks like this:
const api = new ApiGatewayV1Api(this, 'CustFeedbackApi', {
defaultAuthorizer: authorizer,
routes: {
'POST /save': {
function: 'src/handler/saveFeedbackHandler.handleSaveFeedback',
methodOptions: {
authorizationType: AuthorizationType.NONE,
},
},
'GET /retrieve': {
function:
'src/handler/retrieveFeedbackHandler.handleRetrieveFeedback',
methodOptions: {
authorizationType: AuthorizationType.CUSTOM,
},
},
},
});
So, how do I set auth for one route but not another?Ross Coundon
04/19/2021, 9:04 PMJakob Fix
04/19/2021, 9:31 PMdefaultFunctionProps
to a Cron
construct, but while the deployment doesn’t break, I don’t see the environment variables created in the AWS console, and when I checked the SST documentation, this property wasn’t mentioned.
This is what it looks like now, and its equivalent works OK for the Api
construct:
// Create a Cron job to ping each morning at 9h15 CEST
new sst.Cron(this, "Cron", {
defaultFunctionProps: {
environment: {
CALENDAR_ID: ssm.StringParameter.valueForStringParameter(this, 'CALENDAR_ID'),
// FIXME: cannot currently use SecureStrings because: <https://github.com/aws/aws-cdk/issues/6819>
GOOGLE_APPLICATION_CREDENTIALS_EMAIL: ssm.StringParameter.valueForStringParameter(this, 'GOOGLE_APPLICATION_CREDENTIALS_EMAIL'),
GOOGLE_APPLICATION_CREDENTIALS_KEY: ssm.StringParameter.valueForStringParameter(this, 'GOOGLE_APPLICATION_CREDENTIALS_KEY'),
GOOGLE_APPLICATION_CREDENTIALS_KEY_ID: ssm.StringParameter.valueForStringParameter(this, 'GOOGLE_APPLICATION_CREDENTIALS_KEY_ID'),
SLACK_WEBHOOK_URL: ssm.StringParameter.valueForStringParameter(this, 'SLACK_WEBHOOK_URL'),
GIPHY_APIKEY: ssm.StringParameter.valueForStringParameter(this, 'GIPHY_APIKEY'),
SLACK_SIGNING_SECRET: ssm.StringParameter.valueForStringParameter(this, 'SLACK_SIGNING_SECRET'),
}
},
schedule: "cron(15 7 ? * MON-FRI *)",
job: "src/cronjob.handler"
});
Ross Coundon
04/19/2021, 9:55 PMnew PolicyStatement({
actions: ['dynamodb:*'],
effect: Effect.ALLOW,
resources: [
'arn:aws:dynamodb:eu-west-2:12345667889:table/mytable/*',
'arn:aws:dynamodb:eu-west-2:12345667889:table/mytable',
],
});
I’m still getting an error about not having the permission to PutItem so I wanted to try adding consumers to a table construct instead but I don’t quite understand the sample.
From the doc here it shows:
import { Table } from "@aws-cdk/aws-dynamodb";
new Table(this, "Table", {
dynamodbTable: Table.fromTableArn(stack, "MyDynamoDBTable", tableArn),
});
Is this something i need to do from within my SST stack? If so, what is stack
referencing?Uncharted
04/20/2021, 10:11 AMnpx sst deploy --myParameters myValue
Jack Fraser
04/20/2021, 8:29 PMauthorizationType
using a custom function? Similar to Serverless framework can have custom function for the authorizer
.
The reason for this is both for authorisation and to load in extra data onto the event.requestContext.authorizer
Ross Coundon
04/20/2021, 9:08 PMconst authFunc = new Function(this, 'AuthorizerFunction', {
handler: 'src/main/handler/firebaseAuth.handler',
timeout: 30,
environment,
});
const authorizer = new RequestAuthorizer(this, 'Authorizer', {
handler: authFunc,
resultsCacheTtl: Duration.millis(0),
identitySources: [IdentitySource.header('Authorization')], // I think this should extract the token and add to the authorizationToken property of the event
});
const retrieveHandler = new Function(this, 'retrieveHandler', {
handler:
'src/main/handler/retrieveFeedbackHandler.handleRetrieveFeedback',
timeout: scope.local ? 30 : 5,
environment,
});
const api = new ApiGatewayV1Api(this, 'CustFeedbackApi', {
defaultAuthorizer: authorizer,
defaultAuthorizationType: AuthorizationType.CUSTOM,
cors: true,
routes: {
'GET /retrieve': {
function: retrieveHandler,
},
},
});
Is there something I’m missing in how to define the auth function or hook it up to the API?gio
04/27/2021, 7:09 AMnew Api(this, "Api", {
routes: {
"GET /notes": {
function: {
srcPath: "src/",
handler: "list.main",
environment: { tableName: table.tableName },
permissions: [table],
logGroup: 'Notes-API-dev-readNote'
},
},
},
});
Pål Brattberg
04/27/2021, 9:12 AMsst start
, but works with sst deploy
. I have tried both for a Function and an Api path. Anybody using this?