Kujtim Hoxha
05/13/2022, 3:13 PMjson
field supposed to be, I am hitting the WTF here š (using mysql)Leo Hick
05/13/2022, 3:33 PMDan Van Brunt
05/13/2022, 3:51 PMbundle copyFiles
LiveEdit/Dev mode for sst.Function
?
bundle: {
copyFiles: [
{
from: './eventSchema.js',
to: 'schemas/eventSchema.js',
},
],
},
This doesnāt seem to work for usā¦
const getDirectories = (source: string) =>
fs
.readdirSync(source, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name)
const things = getDirectories(__dirname)
console.log(things)
getting []
for directoriesAnthony Sanchez
05/13/2022, 11:12 PMT Indie
05/14/2022, 1:48 PMFatih ErdinƧ
05/14/2022, 5:30 PMconst domainLogsTable = new sst.Table(this, process.env.TABLE_DOMAINLOGS, {
fields: {
id: sst.TableFieldType.STRING,
domainName: sst.TableFieldType.STRING,
time: sst.TableFieldType.NUMBER
},
primaryIndex: {partitionKey: "id"},
globalIndexes: {
domainNameIndex: {partitionKey: "domainName", projection: "all", sortKey: "time"}
},
dynamodbTable: {
removalPolicy: RemovalPolicy.DESTROY,
},
});
const domainTable = new sst.Table(this,process.env.TABLE_DOMAIN, {
fields: {
domainName: sst.TableFieldType.STRING
},
primaryIndex: {partitionKey: "domainName"}
});
const api = new sst.Api(this, "Api", {
routes: {
"GET /": "src/lambda.handler",
},
defaultFunctionProps: {
permissions: [domainTable,domainLogsTable]
}
});
but i get accessdeniedexception when put item to dynamodbBoris Tane
05/14/2022, 5:31 PMimport { StringParameter } from "aws-cdk-lib/aws-ssm";
const rootDomain = StringParameter.valueForStringParameter(this, `/myApp/domain`);
new ApiGatewayV1Api(this, "Api", {
customDomain: {
domainName: `api.${rootDomain}`,
hostedZone: rootDomain,
},
routes: {
"GET /notes": "src/list.main",
},
});
I get this
Error: Cannot determine scope for context provider hosted-zone.
This usually happens when one or more of the provider props have unresolved tokens
it works only when the hostedZone
is a hardcoded string and not the value from ssm parameter store.
my dev deps:
"@serverless-stack/cli": "^1.1.0",
"@serverless-stack/resources": "^1.1.0",
"@tsconfig/node14": "^1.0.1",
"@types/aws-lambda": "^8.10.70",
"@types/node": "<15.0.0",
"aws-cdk-lib": "2.24.0"
Schuyler Sloane
05/14/2022, 8:16 PMSchuyler Sloane
05/14/2022, 10:19 PMJimmy
05/15/2022, 8:56 AMimport { Template } from "aws-cdk-lib/assertions";
import * as sst from "@serverless-stack/resources";
import MyStack from "../lib/MyStack";
test("Test Stack", () => {
const app = new <http://sst.App|sst.App>();
// WHEN
const app = app.stack(MyStack)
// THEN
try {
const template = Template.fromStack(stackIsMissingHere);
template.resourceCountIs("AWS::Lambda::Function", 1);
// Print out a test string that parent .test.js can catch
console.log("JESTTESTSUCCESS-----");
} catch (e) {
// Ignore any errors
}
});
Devin
05/15/2022, 4:59 PMChristian
05/15/2022, 7:45 PMerror: panic: Expected scope (6, 2125) in <FILEPATH>, found scope (6, 1649)
Iāve searched the github repos of sst, esbuild, etc. but nothing comes up. Iāve tried every combination of tsconfig I can think of and none work, reduced the API stack down to just one fn and I still get it⦠Iām at a loss. Has anyone seen this?
Iāve attached the full log.Tobias T
05/16/2022, 9:12 AMQueue
and Im trying to publish messages to it. Getting the following error.
UnknownEndpoint: Inaccessible host: `my-queue-name' at port `undefined'. This service may not be available in the `eu-north-1' region.
I have passed in queueUrl
as this example (https://github.com/serverless-stack/serverless-stack/blob/master/examples/queue/stacks/MyStack.ts)
environment: {
queueUrl: queue.queueName,
},
Meris Tarhanis
05/16/2022, 9:55 AMnpx sst start
) everything works correctly, but when I try to use the deployed version of my app (be it via auto Seed deployment or npx sst deploy
) my API is not working at all. Does anyone know what might be the issue?Miguel
05/16/2022, 12:24 PM0.69.7
to 1.1.1
I changed my stack for a functional stack and managed to make it deploy properly. However, although I installed vitest
and tried to fix my tests it seems Iām doing something wrong since I keep getting an error when I run npm test
The error is located in this line:
const goLambda = new lambda.Function(stack, 'triggerRawToProcessJobGo', {
environment,
runtime: lambda.Runtime.GO_1_X,
handler: 'ingestion',
layers: [appConfigLayer],
code: lambda.Code.fromAsset('src/backend/mainmodule',
....
}),
});
it says this:
Error: Failed to bundle asset dev-my-app/triggerRawToProcessJobGo/Code/Stage, bundle output is located at /private/var/folders/jf/4x6j7wjd7vv57m6q_n0458b00000gn/T/cdk.out2KAJkC/asset.15f36b77f48997c8703e2300c8a640d5fdb2eddc95f4eb4607c00b74a8bc8053-error: TypeError [ERR_INVALID_OPT_VALUE]: The value "WritableWorkerStdio {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,..." is invalid for option "stdio"
It looks to me that it might be related to a path
issue in the code
property. Some difference between the test framework and the normal deployment. But it was working as is before the upgrade so Iām having issues solving it.
Thanks for any help!Tobias T
05/16/2022, 12:39 PMRoss Coundon
05/16/2022, 2:23 PMTrey Overton
05/16/2022, 2:41 PM"Error: Cannot find module 'punycode/'\nRequire stack:\n- /var/task/src/lambda.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js"
Oddly, when testing the function locally, it works fine, but when deployed via Seed, it does not. I am lost as to where to go look to resolve this. Any suggestions?Meris Tarhanis
05/16/2022, 2:51 PMimport { fileTypeFromBuffer } from 'file-type';
import AWS from 'aws-sdk';
When I try sending a request to any of those endpoints, I get this error message from lambda CloudWatch log:
2022-05-16T14:45:28.071Z undefined ERROR Uncaught Exception
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'node:fs'\nRequire stack:\n- /var/task/src/endpoints/files/create.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'node:fs'",
"Require stack:",
"- /var/task/src/endpoints/files/create.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
" at internal/main/run_main_module.js:17:47"
]
}
I suspect that Node's filesystem is not importing these packages correctly. Any suggestion on what might be the problem and/or how to fix it?AdriƔn Mouly
05/16/2022, 7:19 PMStaticSite
.
Before the upgrade, I had the following config with āalternateNamesā and ācertificateā.
I see some breaking changes adding cdk
object, but still getting an error?Garret Harp
05/16/2022, 10:10 PMlgupta
05/17/2022, 3:50 AMdefaults: {
function: {
environment,
vpc: vpc,
vpcSubnets: {
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
},
bundle: {
externalModules: ['pg', 'better-sqlite3', 'mysql2']
}
}
},
But the above does not work when I try to deploy with seed.run
Error: There was a problem transpiling the Lambda handler: > node_modules/kysely/dist/cjs/dialect/postgres/postgres-driver.js:80:68: error: Could not resolve "pg" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
80 ā ... const pgModule = await Promise.resolve().then(() => require('pg'));
āµ ~~~~
> node_modules/kysely/dist/cjs/dialect/sqlite/sqlite-driver.js:68:72: error: Could not resolve "better-sqlite3" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
68 ā ...ule = await Promise.resolve().then(() => require('better-sqlite3'));
āµ ~~~~~~~~~~~~~~~~
> node_modules/kysely/dist/cjs/dialect/mysql/mysql-driver.js:99:71: error: Could not resolve "mysql2" (mark it as external to exclude it from the bundle, or surround it with try/catch to handle the failure at run-time)
99 ā ...mysqlModule = await Promise.resolve().then(() => require('mysql2'));
Please let me know if there is anything else that I need to add to the config. Thanks
cc: @thdxr @Frankheyysaiii
05/17/2022, 4:40 AMCrhistian Caraballo
05/17/2022, 1:00 PMAleksa Miseljic
05/17/2022, 1:13 PMHarris Newsteder
05/17/2022, 2:57 PMHarris Newsteder
05/17/2022, 8:40 PMAdrian Schweizer
05/17/2022, 11:22 PMstacks/StorageStack.js (15,36): Type '"GET"' is not assignable to type 'HttpMethods'.
13. allowedHeaders: ["*"],
14. allowedMethods: ["GET", "PUT", "POST", "DELETE", "HEAD"],
15. },
Seems weird to me, because "GET" is indeed in HttpMethods. Some Typescript thing I'm not getting?Adrian Schweizer
05/17/2022, 11:25 PMstacks/AuthStack.js (58,23): Object is possibly 'undefined'.
56. UserPoolId: auth.userPoolId,
57. IdentityPoolId: auth.cdk.cfnIdentityPool.ref,
58. UserPoolClientId: auth.cdk.userPoolClient.userPoolClientId,
I tried to migrate this with the migration guide, which told me to move cognitoCfnIdentityPool ā cdk.cfnIdentityPoolEmanuel Bohnenkamp
05/18/2022, 12:46 AM