Jack G
01/11/2022, 11:51 AMXelian
01/11/2022, 2:06 PMhttps://i.imgur.com/uxFt0E9.pngā¾
Dan Van Brunt
01/11/2022, 8:01 PMyarn start
without error now.
TypeError: Cannot read properties of undefined (reading 'Symbol(@aws-cdk/core.Stack.myStack)')
at Function.of (/Users/me/Projects/idx/node_modules/@aws-cdk/core/lib/stack.ts:72:37)
at lambdaAuthorizerArn (/Users/me/Projects/idx/node_modules/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts:100:23)
at HttpLambdaAuthorizer.bind (/Users/me/Projects/idx/node_modules/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts:74:24)
Dan Van Brunt
01/11/2022, 10:35 PMSST v0.56.2
issue local only, pipeline works fine.
yarn build --stage dvb-idx
results in these 3 errorsā¦AdriĆ”n Mouly
01/11/2022, 11:01 PMSam Hulick
01/12/2022, 12:03 AMsst start
? I keep getting an error: Error: Failed to get the current sub/segment from the context. at Object.contextMissingRuntimeError [as contextMissing]
but this doesnāt happen once I deploy to production. this probably has something to do with SSTās trickery of executing function code locallyMarcos Sampaio
01/12/2022, 4:56 AMDaniel Gato
01/12/2022, 7:04 AMGreg Martin
01/12/2022, 4:28 PMcustomDomain:
scope.stage === "prod"
? {
domainName: "<http://colemanrodeo.com|colemanrodeo.com>",
domainAlias: "<http://wwww.colemanrodeo.com|wwww.colemanrodeo.com>",
}
: {
domainName: scope.stage + ".<http://colemanrodeo.com|colemanrodeo.com>",
},
path: "frontend",
Help would be most appreciated. šDan Russell
01/12/2022, 4:57 PMconst authorizer = new HttpLambdaAuthorizer({
authorizerName: "QuizAuthorizer",
responseTypes: [HttpLambdaResponseType.IAM],
handler: new sst.Function(this, "Authorizer", {
handler: "src/authorizer.main",
}),
resultsCacheTtl: Duration.seconds(0)
});
const api = new sst.Api(this, `api`, {
defaultAuthorizationType: sst.ApiAuthorizationType.CUSTOM,
defaultAuthorizer: authorizer,
defaultFunctionProps: {
srcPath: "src/",
environment: {
NODE_ENV: process.env.NODE_ENV || 'development',
STAGE: scope.stage,
},
},
cors: {
allowHeaders: [
'X-Amz-Date',
'X-Api-Key',
'X-Amz-Security-Token',
'X-Requested-With',
'X-Auth-Token',
'Referer',
'User-Agent',
'Origin',
'Content-Type',
'Authorization',
'Accept',
'Access-Control-Allow-Methods',
'Access-Control-Allow-Origin',
'Access-Control-Allow-Headers'],
allowMethods: [
CorsHttpMethod.GET,
CorsHttpMethod.PUT,
<http://CorsHttpMethod.POST|CorsHttpMethod.POST>,
CorsHttpMethod.DELETE,
CorsHttpMethod.OPTIONS,
],
allowOrigins: ['<http://localhost:3000>'],
allowCredentials: true
},
routes: {
'ANY /quiz': {
authorizationType: sst.ApiAuthorizationType.NONE,
function: "lambda.handler",
},
'ANY /{proxy+}': "lambda.handler"
},
});
And the Axios call the /quiz/<id> route goes through the authorizer
const headers = {
Authorization: "Bearer 123",
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
};
export const getQuiz = async (id) => {
try {
const resp = await axios.get(
`${process.env.REACT_APP_API_URL}/quiz/${id}`,
{ headers }
);
return resp.data;
} catch (err) {
console.log(err);
return { error: err.message || "Unknown Error getting Quiz" };
}
};
Sam Hulick
01/12/2022, 7:25 PMsst start
mode, correct? I think I remember reading that in a previous conversation. that hasnāt changed at all, I assume?Seth Geoghegan
01/12/2022, 8:44 PMexport default function main(app: <http://sst.App|sst.App>): void {
const requestsLayer = (stack) => LayerVersion.fromLayerVersionArn(stack, "requestsLayer", requestsLayerArn);
const psycopgLayer = (stack) => LayerVersion.fromLayerVersionArn(stack, "psycopgLayer", psycopgLayerArn);
app.setDefaultFunctionProps((stack) => {
// other config omitted
const props = {
runtime: "python3.8",
srcPath: "src",
logRetention: config.logRetention,
layers: app.local ? [] :[requestsLayer(stack),psycopgLayer(stack)], // <--- this is working
vpc: vpc,
subnets: vpc.publicSubnets,
securityGroups: [securityGroup],
bundle:{
externalModules: app.local ? [] : [requestsLayer,psycopgLayer] // <--- should this work ??
}
return props;
}
}
Sam
01/13/2022, 3:35 AMApiAuthorizationType.NONE
The question is how do I detect whether a logged-in user made a request to this endpoint as event.requestContext.authorizer
doesn't exist for ApiAuthorizationType.NONE
endpoints.
I'm using AWS_IAM
as my authorization type for authenticated APIs.
Thanks.Daniel Gato
01/13/2022, 9:20 AMMichele
01/13/2022, 3:22 PM{
"errorType": "Runtime.UserCodeSyntaxError",
"errorMessage": "SyntaxError: Unexpected token 'export'",
"stack": [
"Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token 'export'",
" at _loadUserApp (/var/runtime/UserFunction.js:98: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"
]
}
This burst of errors is limited to a 15 min timespan, before & after the logs are are fine with no other issues reported.
Weāre not making any use of the /api
routes in the NextJS project so we donāt need any support for its ābackendā.
Would you have any tip on how to troubleshoot this issue?
Thank you in advance!Dan Van Brunt
01/13/2022, 3:28 PMDerek Kershner
01/13/2022, 4:53 PM0.53.2
to 0.58.0
. No other actions.
Symptoms:
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | CREATE_FAILED | AWS::Lambda::Version | AdminIdentityWebAppNextJsSiteApiFunctionCurrentVersion42206DF251f45f4f60760bb3fec1986818833736 | A version for this Lambda function exists ( 2 ). Modify the function to create a new version.
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | CREATE_FAILED | AWS::Lambda::Version | AdminIdentityWebAppNextJsSiteImageFunctionCurrentVersionFEA047D3cea01b8892c8bacfeceb61e122debf40 | A version for this Lambda function exists ( 2 ). Modify the function to create a new version.
staging-ResonanceWebAppAdminIdentity-AdminIdentityWebAppStack | UPDATE_FAILED | AWS::Lambda::Function | AdminIdentityWebAppNextJsSiteMainFunctionCFE178A8 | Resource update cancelled
Boris Tane
01/13/2022, 6:09 PMscope.node.root
to get the overarching sst App but I'm trying to get the stack such that I can pass it to cdk.Arn.format
Dan Van Brunt
01/13/2022, 6:48 PMDerek Kershner
01/13/2022, 7:04 PMTypeError: Cannot read property 'slice' of undefined
at new Function (/home/dkershner/repos/resonanceapps-monorepo-supply-customdata-manager/node_modules/@serverless-stack/resources/src/Function.ts:184:8)
Version 0.58.0, also received on 0.53.x
This is a very simple stack, creating one lambda function. The error occurs on build
.
The code in the stack trace is
// Merge with app defaultFunctionProps
// note: reverse order so later prop override earlier ones
stack.defaultFunctionProps
.slice()
.reverse()
.forEach((per) => {
props = Function.mergeProps(per, props);
});
Dan Van Brunt
01/13/2022, 9:15 PMDan Van Brunt
01/13/2022, 10:45 PMDevin
01/14/2022, 2:39 AMRoss Gerbasi
01/14/2022, 6:24 AMStaticSite
construct to deploy a CloudFront backed S3 site, all working great. I have a <http://uxuxxuu.cloudfront.net|uxuxxuu.cloudfront.net>
url.
I then attempted to go to Cloud*Flare* and setup a CNAME from my domain to this CloudFront url. This did not work and resulted in a CloudFront 403 error. Turns out you need to add alternate domains to the CloudFront instance to allow access to it.
So to test this I manually pop'd into the AWS console and added an alternate domain to the CloudFront instance. However in order to do this I have to use ACM to get a certificate. Certificate required the domain I wished to use, and gave me a CNAME entry I had to enter into Cloud*Flare* to prove I have permissions for the domain. This went pretty quick and once the cert was validated, I added the alternate domain to CloudFront and added the newly requested cert.
After a couple seconds everything was connected and my custom domain worked. So ended up with Cloud*Flare* DNS -> CloudFront -> S3. Which is what I wanted.
So why am I writing all this? Well I am curious if SST can help me with any of this process. I am going to assume the answer is No, as I need to manually enter the cert info into Cloud*Flare* to get this working. However there is an API so maybe this could get automated... Either way I am wondering if SST can help with any step here, maybe it can create the AWS Cert for me, then I would manually have to go in and get the info, add it to Cloud*Flare*, and add the alt domain to the CloudFront instance.
All of this would only need to be set in production, and once set once should be ok. I also wanted to confirm no one sees any major issues with manually going into AWS and adjusting these things after the SST deploy. Any reason future deploys would mess with this? Or does it seem fairly safe to setup once and be good?
Our Org is all about Cloud*Flare* so we want to stick with it, otherwise we would just go all in on Route53/CloudFront, but I have been asked to make sure Cloud*Flare* stays in the mix.
Any thoughts, concerns, experience would be greatly appreciated! Thanks!Bjorn Theart
01/14/2022, 6:47 AMJoe Qureshi
01/14/2022, 1:53 PMDan Van Brunt
01/14/2022, 3:36 PM<https://xxxxxxx.execute-api.us-east-1.amazonaws.com>
not this <https://xxxxxxx.execute-api.us-east-1.amazonaws.com/stage_here>
Ross Gerbasi
01/14/2022, 4:26 PM[WARNING] @aws-cdk/core.ConstructNode#metadata is deprecated.
use `metadataEntry`
This API will be removed in the next major release.
Hard to pinpoint exactly what's causing it but I think its the call to certificate: Certificate.fromCertificateArn(_this_, "MyCert", certArn),
which seems to come from the CDK. So far only able to find this (https://github.com/aws/aws-cdk/issues/17633) so maybe a CDK version bump will do it. Anyone else seeing this warning?Toby Harris
01/14/2022, 5:00 PMError: Cannot find module 'SST'
.
On Create an SST app, the commands were successful.
On Create a Hello World API, this happens ā
> npx sst start
Using stage: [...]
Preparing your SST app
=======================
Deploying debug stack
=======================
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'SST'
Require stack:
- [...]/notes2/node_modules/@serverless-stack/cli/assets/debug-stack/bin/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> ([...]/notes2/node_modules/@serverless-stack/cli/assets/debug-stack/bin/index.js:28:17)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'[...]/notes2/node_modules/@serverless-stack/cli/assets/debug-stack/bin/index.js'
]
}
Subprocess exited with error 1
There was an error synthesizing your app.
That not working, I then had some success with the commands per the README, e.g. npm install
, npm run deploy
but then npm run remove
failed as above.
Occamās razor says itās my environment somehow, but while Iām new to SST I have happily used Node / npm for many projects before.
Iām stuck, and SST is so promising otherwise!Cptflammin
01/14/2022, 5:39 PM