Nicklas Christiansen
03/07/2022, 9:11 PMfunction createEvent(content) {
return <http://API.post|API.post>("notes", "/events", {
body: content
});
}
I tried to add this to routes in ApiStack.js:
"POST /events": "src/createEvent.main",
With this createEvent:
import * as uuid from "uuid";
import handler from "./util/handler";
import dynamoDb from "./util/dynamodb";
export const main = handler(async (event) => {
const data = JSON.parse(event.body);
const params = {
TableName: process.env.TABLE_NAME,
Item: {
// The attributes of the item to be created
eventId: uuid.v1(), // A unique uuid
name: data.content, // Parsed from request body
max_players: data.max_players,
createdAt: Date.now(), // Current Unix timestamp
},
};
await dynamoDb.put(params);
return params.Item;
});
Added this to StorageStack.js:
this.table2 = new sst.Table(this, "Events", {
fields: {
eventId: sst.TableFieldType.STRING,
},
primaryIndex: { partitionKey: "eventId" },
});
Hans Song
03/08/2022, 12:34 AMsst cdk deploy --toolkit-stack-name mystackname
work as expected?
• is there any way for lambas running in the sst runtime to have their output logged to stdout/stderr as well?Ross Gerbasi
03/08/2022, 1:18 AMnpm run test
it can't find jest. Is this expected? If so do we need to install jest and configure TS for it ourselves now?Michael James Munar
03/08/2022, 2:44 AMcustomDomain: {
domainName: '<http://customDomain.com|customDomain.com>',
isExternalDomain: true,
certificate: Certificate.fromCertificateArn(this, 'Digital Ocean Certificate', certificate-arn),
}
I have also tried to configure custom domain in API Gateway and hosted zone in route 53, but nothing seems to workFazi
03/08/2022, 2:07 PMTypeError: Cannot read properties of undefined (reading 'logs')
at /Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/cli/scripts/start.js:176:13
at recipe (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/core/dist/local/server.js:76:17)
at Immer.produce (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/immer/src/core/immerClass.ts:94:14)
at Immer.produceWithPatches (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/immer/src/core/immerClass.ts:141:23)
at updateState (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/core/dist/local/server.js:48:64)
at Object.updateFunction (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/core/dist/local/server.js:65:20)
at /Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/cli/scripts/start.js:174:11
at EventDelegate.trigger (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/core/dist/runtime/server.js:29:13)
at Socket.<anonymous> (/Users/user/Desktop/services-python-app-integration/app_integration/node_modules/@serverless-stack/core/dist/runtime/server.js:233:31)
at Socket.emit (node:events:527:28)
Any idea what could be causing this? Dependencies:
"@serverless-stack/cli": "0.67.2",
"@serverless-stack/resources": "0.67.2",
"aws-cdk-lib": "2.15.0",
"@tsconfig/node14": "^1.0.1",
"@types/aws-lambda": "^8.10.93",
"@types/node": "^17.0.21"
Luca Carangella
03/08/2022, 3:40 PMLuca Carangella
03/08/2022, 3:53 PMthdxr
03/08/2022, 4:08 PMThomas Ankcorn
03/08/2022, 4:11 PMMaged Mortaga
03/08/2022, 4:11 PMhandleSuccess
/ handleError
Jeff Hanna
03/08/2022, 5:30 PMJan Plaček
03/08/2022, 6:20 PMsst-evn
Or is it already possible?Jeff Hanna
03/08/2022, 6:52 PMRoss Coundon
03/08/2022, 9:18 PMcreatePortfolioDataBuckets(removalPolicy: RemovalPolicy, countries: string[]): EnvVarBucketMap {
const envVarBucketMap: EnvVarBucketMap = {};
for (const country of countries) {
const bucket = new sst.Bucket(this, `${this.stage}-${country}-portfolio-data`, {
s3Bucket: {
removalPolicy,
accessControl: BucketAccessControl.PRIVATE,
blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
versioned: true,
bucketName: `${this.stage}-${country}-portfolio-data`,
},
});
bucket.s3Bucket.addCorsRule(corsBucketRule);
const envVarName = `${country.toUpperCase()}_PORTFOLIO_BUCKET`;
envVarBucketMap[envVarName] = bucket;
}
return envVarBucketMap;
}
This function is called only once in the stack, the value of the string array that’s passed in is ['germany', 'italy']
so the bucket names and IDs should be unique. Can anyone see what could be causing the issue?Jeff Hanna
03/08/2022, 9:44 PMuat-polls-api-Database failed: Export uat-polls-api-Database:ExportsOutputRefDatabaseB269D8BB88F4B1C4 cannot be updated as it is in use by uat-polls-api-Api, uat-polls-api-Auth and uat-polls-api-Migrate
FYI under the hood restoring actually creates a new serverless cluster from the snapshotmatt resnik
03/08/2022, 10:46 PMMichael James Munar
03/09/2022, 12:14 PMShadab
03/09/2022, 12:21 PMSulaiman Baig
03/09/2022, 2:28 PMSulaiman Baig
03/09/2022, 3:33 PMRoss Gerbasi
03/09/2022, 8:23 PMsst deploy
read from env
files early enough to set a profile? Just checking out the docs here, https://docs.serverless-stack.com/packages/cli#aws-profile realizing I would like to swap profiles. If I have a AWS_PROFILE
in my .env
or .env.production
will that get picked up or does it need to get set prior to running the command AWS_PROFILE=production npx sst deploy
Jeff Hanna
03/09/2022, 10:13 PMJeff Hanna
03/09/2022, 11:21 PMDavid Rollins
03/10/2022, 12:58 AMTonny (sstNerd)
03/10/2022, 5:06 AMSulaiman Baig
03/10/2022, 5:27 AMBrinsley
03/10/2022, 7:17 AMmigrations
param so no idea why it suddenly started blowing up. Any ideas on this?
TypeError: Cannot read property 'secretArn' of undefined
at RDS.createMigrationsFunction (/Users/me/Git/repo/node_modules/@serverless-stack/resources/src/RDS.ts:287:55)
at new RDS (/Users/me/Git/repo/node_modules/@serverless-stack/resources/src/RDS.ts:130:36)
at new ApiStack (/Users/me/Git/repo/stacks/ApiStack.ts:77:20)
at Object.main (/Users/me/Git/repo/stacks/index.ts:35:5)
at Object.<anonymous> (/Users/me/Git/repo/.build/run.js:94:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
Jan Plaček
03/10/2022, 10:08 AMsst start
it works no longer even for the previously added function.
EDIT:
It does not work to anyone of us, it doesn't seem to be a local issue.
I use both explicit Function creation and the ones scaffolded by SST from function props, neither works.
EDIT 2:
Found out what's wrong. The changes are picked up correctly (based on sst-debug.log
), but it won't rebuild/reload the function unless you hit the endpoint with a request at least once. Is this by design?Brinsley
03/10/2022, 10:17 AMstart
). Got the following error in CloudWatch:
ERROR [Error: EROFS: read-only file system, copyfile '/var/task/sst_rds_migration_scripts/000001_create_tables.js' -> '/var/task/sst_rds_migration_scripts/000001_create_tables.js1646905935564.js'] {
errno: -30,
code: 'EROFS',
syscall: 'copyfile',
path: '/var/task/sst_rds_migration_scripts/000001_create_tables.js',
dest: '/var/task/sst_rds_migration_scripts/000001_create_tables.js1646905935564.js'
}
Currently Googling, any ideas?Mischa Spiegelmock
03/10/2022, 11:49 AM