Mike McCall
11/26/2021, 6:43 PMnpx sst update
is only updating the @serverless-stack/resources
version.O'Dell Sallis
11/26/2021, 9:42 PMArtem Kalantai
11/28/2021, 5:01 PMLincoln Waddell
11/28/2021, 10:15 PMlibs/
shared-component.ts
services/
service1/
src/
stacks/
package.json
sst.json
tsconfig.json
services2/
etc.
Whenever I reference shared-component.ts
inside any of the services I get the following error even though my service has the eslintConfig property present in package.json:
No eslint config found. There was a change starting in SST v0.48.0 with the eslint integration for better editor support. Please add the following to your package.json:
"eslintConfig": {
"extends": ["serverless-stack"]
}
Any suggestions to allow for typescript files shared between services? Apologies in advance if this is a totally ignorant question. This is my first adventure in typescript.
Thank you!Franco Gotusso
11/29/2021, 4:13 PMroot
├── package-a/
│ ├── package.json
│ ├── tsconfig.json
│
├── package-b/
├── package.json
├── tsconfig.json
And package-a references package-b in the following way
package-a/package.json
{
"dependencies": {
"@company/package-b": 1.0.0,
}
}
package-a/tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@company/package-a/*": [
"src/*"
],
"@company/package-b/*": [
"../package-b/src/*"
]
}
}
}
We're doing this to avoid repackaging and reinstalling package-b every time while developing, but we now noticed that while running sst start
, package-b
gets added automatically to externalModules
and hence not bundled when in reality we want it to be bundled. Any suggestions on how to work around this or make it better? Thanks!Colin Cheung
11/29/2021, 4:31 PMsst deploy
to use the output of a previous`sst build` ?
It doesn't seem like running sst build
before sst deploy
makes it any quicker.Victor Rodriguez
11/29/2021, 9:08 PMv0.53.2
. It's a typescript project. Every time I try running sst build
I get Error: ENAMETOOLONG: name too long, copyfile. /Users/vrodriguez/Projects/***/***/***/.build/cdk.out/asset.***
. Anyone seen anything similar before?Tim V
11/29/2021, 10:47 PMSahan Amadoruge
11/30/2021, 12:34 PM<Code>SignatureDoesNotMatch</Code>
Victor Rodriguez
11/30/2021, 5:54 PMCfnInclude
, path.join(__dirname, "../../path/to/file")
works
When using sst constructs, it respects the baseUrl in tsconfig.json
, in my case, ./
which is src
, so src/path/to/file
works
For experimental.EdgeFunction
, Code.fromAsset
, seems like it should work the same as CfnInclude
, but I always get:
Error: ENOENT: no such file or directory, copyfile '/Users/***/Projects/***/***/node_modules/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.js' -> '/Users/***/Projects/***/***/lambdas/.build/lib/edge-function/__entrypoint__.js'
Sam Hulick
11/30/2021, 6:27 PMDan Van Brunt
11/30/2021, 7:36 PM_redirects
file in the root of the StaticSite Bucket. The issue right now is that StaticSite puts the file deploys into bucket keys/directories like deploy-4f8996501e982c7d7a6bdcd3c2396bc5
so how can we let the edge function know which is the current? (without having to rebuild our lambda functions)mkarsene
12/01/2021, 1:41 AMimport mjml2html from "mjml";
import { createSSRApp } from "vue";
import { renderToString } from "@vue/server-renderer";
import { newRequestTemplate } from "./templates/new-request-template"; // This is just an mjml template
export async function handler(event) {
const email_data = JSON.parse(event.body); // input data
try {
const app = createSSRApp({
data() {
return email_data;
},
template: newRequestTemplate,
});
// Tell Vue to recognize mjml components. See: <https://v3.vuejs.org/api/application-config.html#iscustomelement>
app.config.compilerOptions.isCustomElement = (tag) => tag === "mjml" || tag.startsWith("mj-");
// Render the Vue instance to a variable as a string
let html = await renderToString(app);
// Remove <!--[--> and <!--]--> add by the server renderer.
html = html.replace("<!--[-->", "").replace("<!--]-->", "");
// Let mjml do its magic
const res = mjml2html(html);
return {
statusCode: 200,
headers: { "Content-Type": "html" },
body: res.html,
};
} catch (error) {
console.log(":rocket: ~ file: lambda.js ~ line 32 ~ handler ~ error", error);
return {
statusCode: 200,
headers: { "Content-Type": "html" },
body: null,
};
}
}
The Error I get is this : { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module '../lib/utils.js'\nRequire stack:\n- /var/task/src/lambda.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js", "stack": [ "Runtime.ImportModuleError: Error: Cannot find module '../lib/utils.js'", "Require stack:", "- /var/task/src/lambda.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" ] }
Sam Hulick
12/01/2021, 2:44 AMSahan Amadoruge
12/01/2021, 12:29 PMSam Hulick
12/01/2021, 5:01 PMyarn start
? it’s updating my RDS, KMS key.. kinda random stuffDan Van Brunt
12/01/2021, 10:58 PMstack.resolve(thingy)
work behinds the scenes?
It seems to prevent any future changes to thingy using L2 methods?Jonathan Chapman
12/02/2021, 6:21 AMservice
, env
, and version
tags, but not finding a good way to default them. Any pointers?Pavan Kumar
12/02/2021, 12:21 PMcognitoArn
is null. How would I get around it or what is proper way to do it.
const preSignUpFunction = new sst.Function(this, 'PreSignUp', {
handler: 'users/auth/preSignUp.handler'
})
const userPool = new cognito.UserPool(this, "UserPool", {
lambdaTriggers: {
preSignUp: preSignUpFunction,
}
});
const userPoolClient = new cognito.UserPoolClient(this, "UserPoolClient", {
// ...
});
this.auth = new sst.Auth(this, 'Auth', {
cognito: {
userPool,
userPoolClient,
},
});
const cognitoArn = this.auth.cognitoUserPool?.userPoolArn;
if (cognitoArn) {
const permissions = [
new iam.PolicyStatement({
actions: [
"cognito-idp:AdminCreateUser",
"cognito-idp:AdminDeleteUser",
"cognito-idp:AdminSetUserPassword",
"cognito-idp:AdminDisableUser",
"cognito-idp:AdminEnableUser",
"cognito-idp:AdminUpdateUserAttributes",
],
effect: iam.Effect.ALLOW,
resources: [
cognitoArn
],
})
];
preSignUpFunction.attachPermissions(permissions);
}
Omi Chowdhury
12/02/2021, 2:54 PMJulien Bras
12/02/2021, 3:17 PMNextJs
construct this week, and I found one nasty thing. I need to pass environment variables to the construct in order to provide Cognito User Pool Id and so but my Cognito User Pool is not built inside SST but in a different Cloudformation stack (with Serverless Framework). So I am using the Fn.importValue
but this is not working 😄:
// backend stack export prefix
const backendStackPrefix = `sls-cust-center-backend-${scope.stage}`;
console.log(`UserPool: ` + `${backendStackPrefix}-CognitoUserPool`);
console.log(`UserPool: ` + Fn.importValue(`${backendStackPrefix}-CognitoUserPool`));
// frontend application built using NextJs
new NextjsSite(this, "NextSite", {
path: "../frontend-next",
environment: {
NEXT_PUBLIC_API: Fn.importValue(`${backendStackPrefix}-ServiceEndpoint`),
NEXT_PUBLIC_COGNITO_REGION: this.region,
NEXT_PUBLIC_COGNITO_USER_POOL_ID: Fn.importValue(`${backendStackPrefix}-CognitoUserPool`),
NEXT_PUBLIC_COGNITO_APP_CLIENT_ID: Fn.importValue(`${backendStackPrefix}-CognitoUserPoolClient`),
NEXT_PUBLIC_COGNITO_DOMAIN: Fn.importValue(`${backendStackPrefix}-CognitoDomain`),
NEXT_PUBLIC_COGNITO_IDENTITY_POOL: Fn.importValue(`${backendStackPrefix}-CognitoIdentityPool`),
},
});
The value of the Fn.importValue
is something like ${Token[TOKEN.351]}
so it cannot be used for the next build
part of the NextJs
construct operation.
Do you know how to deal with that elegantly? (I was thinking of calling ListExportsCommand in the Stack but this is not elegant for sure!)
Thanks!Daniel
12/02/2021, 5:38 PMDevin
12/02/2021, 5:55 PM// Create the DynamoDB table
const customersTable = new sst.Table(this, "Customers", {
fields: {
pk: sst.TableFieldType.STRING,
sk: sst.TableFieldType.STRING,
createdAt: sst.TableFieldType.STRING,
customerId: sst.TableFieldType.STRING,
email: sst.TableFieldType.STRING,
firstName: sst.TableFieldType.STRING,
lastName: sst.TableFieldType.STRING,
phone: sst.TableFieldType.STRING,
},
primaryIndex: { partitionKey: "pk", sortKey: "sk" },
});
But i realized that [createdAt, customerId, email, firstName, lastName, phone]
are all values that aren’t being indexed by dynamoDb they’re just values. Should I have them here?Bshr Ramadan
12/02/2021, 7:18 PMsst version 0.43.3
and I've just updated to latest version
after update I am facing this error:
AccessDeniedException: User: arn:aws:sts::702716627781:assumed-role/bshr-cordova-CordovaPubli-publicCordovaGraphqlPric-SJHXCJ61EAQY/public-cordova-pricing-bshr is not authorized to perform: logs:DescribeLogStreams on resource: arn:aws:logs:us-east-1:702716627781:log-group:cordova-bshr:log-stream:
this is the stack:
const apiAuth = new sst.Auth(this, 'auth2', {
cognito: {
userPool: cordovaMainUserPool,
userPoolClient: toledoClient
},
identityPool: {
allowUnauthenticatedIdentities: true,
identityPoolName: `api-identity-pool-${scope.stage}`,
}
});
const publicApi = new sst.ApolloApi(this, 'publicCordovaGraphqlGateway', props);
apiAuth.attachPermissionsForUnauthUsers([publicApi]);
I tried sst remove
and it didn't fix itSahan Amadoruge
12/03/2021, 5:08 AMPavan Kumar
12/03/2021, 6:14 AMnew StackA();
new StackB();
new StackC();
new StackD();
Scenario 1: Deploy all the stacks in parallel.
Scenario 2: Deploy StackA
and StackB
in parallel and StackC
and StackD
depends on StackA
and StackB
hence deploy StackC and StackD
in parallel, but in second stage?Mio Ttraja
12/03/2021, 3:06 PMAdrian Schweizer
12/03/2021, 11:03 PMTonny (sstNerd)
12/05/2021, 3:55 AMconstructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
const { table } = props;
And then I’m getting TS errors b/c table
is not a “typed” property under the sst.StackProps
. That said, what would be the solution here? I was betting on create my own type (kinda like my own type but extending from the sst.StackProps
somehow and also append a table
property and whatever else need across the guide but idk if that’s how it should be in fact, any recommendation?Mischa Spiegelmock
12/05/2021, 2:28 PMDefault function props for the stack must be set before any resources have been added.