Ibrael Espinosa
03/15/2022, 5:10 PMRoss Coundon
03/15/2022, 5:11 PMIbrael Espinosa
03/15/2022, 5:12 PMIbrael Espinosa
03/15/2022, 5:13 PMIbrael Espinosa
03/15/2022, 5:16 PMIbrael Espinosa
03/15/2022, 5:17 PMRoss Coundon
03/15/2022, 5:48 PMIbrael Espinosa
03/15/2022, 10:27 PMIbrael Espinosa
03/15/2022, 10:27 PMRoss Coundon
03/15/2022, 10:32 PMIbrael Espinosa
03/15/2022, 10:32 PMIbrael Espinosa
03/15/2022, 10:33 PMIbrael Espinosa
03/15/2022, 10:34 PMRoss Coundon
03/15/2022, 10:35 PMRoss Coundon
03/15/2022, 10:35 PMIbrael Espinosa
03/15/2022, 10:42 PMIbrael Espinosa
03/15/2022, 10:42 PMRoss Coundon
03/15/2022, 10:48 PMIbrael Espinosa
03/15/2022, 10:56 PM/* eslint-disable no-new */
/* eslint-disable no-unused-vars */
// import MyStack from "./MyStack";
import * as sst from '@serverless-stack/resources'
import { RemovalPolicy } from '@aws-cdk/core'
import AuthStack from './Auth'
import StorageStack from './Storage'
import AppSyncStack from './ApiSync'
//import FrontendStack from './Frontends'
import WebappStack from './Webapp'
import StorybookStack from './Storybook'
import BackofficeStack from './Backoffice'
import CatalogStack from './Catalog'
import { UsersModuleStack } from './UsersModuleStack'
export default function main(app: <http://sst.App|sst.App>): void {
console.log(app)
// Set default runtime for all functions
app.setDefaultFunctionProps({
runtime: 'nodejs14.x'
})
// Remove all resources when the dev stage is removed
if (!['prod', 'staging', 'stage'].includes(app.stage)) {
app.setDefaultRemovalPolicy(RemovalPolicy.DESTROY)
}
const storage = new StorageStack(app, 'Storage', {
description: 'Storage'
})
/*const usersModuleStack = new UsersModuleStack(app, 'UsersModule', {
description: 'Fuck the users'
})
const authStack = new AuthStack(app, 'Auth', {
props: {
description: 'Auth stack'
},
bucket: storage.bucket,
triggers: {
createAuthChallenge: usersModuleStack.createAuthChallenge
}
})
const catalog = new CatalogStack(app, 'Catalog', {
description: 'Catalog'
})
const appsync = new AppSyncStack(app, 'AppSync', {
description: 'GraphQL Api',
auth: authStack.auth,
dataSources: {
offers: {
table: catalog.offersTable.dynamodbTable
},
users: {
table: usersModuleStack.usersTable.dynamodbTable
},
profiles: {
table: usersModuleStack.profilesTable.dynamodbTable
}
}
})*/
new StorybookStack(app, 'Storybook', {
props: {
description: 'Storybook site'
}
})
}
Ibrael Espinosa
03/15/2022, 10:57 PMIbrael Espinosa
03/15/2022, 10:58 PMRoss Coundon
03/15/2022, 11:08 PMIbrael Espinosa
03/15/2022, 11:10 PMIbrael Espinosa
03/15/2022, 11:11 PMLook like you're running sst for the first time in this directory. Please enter a stage name you'd like to use locally. Or hit enter to use the one based on your AWS credentials (srvapp):
Using stage: srvapp
Preparing your SST app
=======================
Deploying debug stack
=======================
/home/ibra/accor/astore/node_modules/aws-cdk-lib/core/lib/app.js:1
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.attachCustomSynthesis=<http://exports.App|exports.App>=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cxapi=require("../../cx-api"),synthesis_1=require("./private/synthesis"),tree_metadata_1=require("./private/tree-metadata"),stage_1=require("./stage"),APP_SYMBOL=Symbol.for("@aws-cdk/core.App");class App extends stage_1.Stage{constructor(props={}){var _b,_c,_d;super(void 0,"",{outdir:(_b=props.outdir)!==null&&_b!==void 0?_b:process.env[cxapi.OUTDIR_ENV]});jsiiDeprecationWarnings.aws_cdk_lib_AppProps(props),Object.defineProperty(this,APP_SYMBOL,{value:!0}),this.loadContext(props.context),props.stackTraces===!1&&this.node.setContext(cxapi.DISABLE_METADATA_STACK_TRACE,!0);const analyticsReporting=(_c=props.analyticsReporting)!==null&&_c!==void 0?_c:props.runtimeInfo;analyticsReporting!==void 0&&this.node.setContext(cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT,analyticsReporting),((_d=props.autoSynth)!==null&&_d!==void 0?_d:cxapi.OUTDIR_ENV in process.env)&&process.once("beforeExit",()=>this.synth()),(props.treeMetadata===void 0||props.treeMetadata)&&new tree_metadata_1.TreeMetadata(this)}static isApp(obj){return APP_SYMBOL in obj}loadContext(defaults={}){for(const[k,v]of Object.entries(defaults))this.node.setContext(k,v);const contextJson=process.env[cxapi.CONTEXT_ENV],contextFromEnvironment=contextJson?JSON.parse(contextJson):{};for(const[k,v]of Object.entries(contextFromEnvironment))this.node.setContext(k,v)}}<http://exports.App|exports.App>=App,_a=JSII_RTTI_SYMBOL_1,App[_a]={fqn:"<http://aws-cdk-lib.App|aws-cdk-lib.App>",version:"2.15.0"};function attachCustomSynthesis(construct,synthesis){synthesis_1.addCustomSynthesis(construct,synthesis)}exports.attachCustomSynthesis=attachCustomSynthesis;
TypeError: Cannot read property 'setContext' of undefined
at DebugApp.loadContext (/home/ibra/accor/astore/node_modules/aws-cdk-lib/core/lib/app.js:1:1543)
at new App (/home/ibra/accor/astore/node_modules/aws-cdk-lib/core/lib/app.js:1:698)
at new DebugApp (/home/ibra/accor/astore/node_modules/@serverless-stack/resources/dist/DebugApp.js:31:9)
at Object.<anonymous> (/home/ibra/accor/astore/node_modules/@serverless-stack/cli/assets/debug-stack/bin/index.js:24:13)
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:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
There was an error synthesizing your app.
error Command failed with exit code 1.
info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
Cristian Pallarés
03/16/2022, 6:54 AMIbrael Espinosa
03/16/2022, 6:59 AMIbrael Espinosa
03/16/2022, 6:59 AMRoss Coundon
03/16/2022, 7:20 AMIbrael Espinosa
03/16/2022, 11:09 AMRoss Coundon
03/16/2022, 11:21 AMjamlen
03/16/2022, 4:57 PMDebugStack
- https://github.com/serverless-stack/serverless-stack/releases/tag/v0.65.3Ibrael Espinosa
03/16/2022, 5:01 PMIbrael Espinosa
03/16/2022, 5:01 PMexport function debugApp(app: <http://sst.App|sst.App>) {
console.log(app)
new sst.DebugStack(app, 'debug-stack', {
stackName: app.logicalPrefixedName('live-debug'),
synthesizer: new cdk.DefaultStackSynthesizer({
qualifier: 'hello'
})
})
cdk.Tags.of(app).add('test', `${app.stage}-${app.region}`)
}
Ibrael Espinosa
03/16/2022, 5:01 PMIbrael Espinosa
03/16/2022, 5:01 PMIbrael Espinosa
03/16/2022, 5:01 PMIbrael Espinosa
03/16/2022, 5:02 PMjamlen
03/16/2022, 5:02 PMIbrael Espinosa
03/16/2022, 5:02 PMjamlen
03/16/2022, 5:03 PMIbrael Espinosa
03/16/2022, 5:04 PMIbrael Espinosa
03/16/2022, 5:05 PMIbrael Espinosa
03/16/2022, 5:05 PMIbrael Espinosa
03/16/2022, 5:06 PMthdxr
03/16/2022, 5:07 PMthdxr
03/16/2022, 5:07 PMthdxr
03/16/2022, 5:08 PMIbrael Espinosa
03/16/2022, 5:14 PMIbrael Espinosa
03/16/2022, 5:14 PMIbrael Espinosa
03/16/2022, 5:14 PMIbrael Espinosa
03/16/2022, 5:15 PMPreparing your SST app
TypeError: Cannot read property 'setContext' of undefined
at App.loadContext (/home/ibra/accor/astore/node_modules/aws-cdk-lib/core/lib/app.ts:152:17)
at new App (/home/ibra/accor/astore/node_modules/aws-cdk-lib/core/lib/app.ts:115:10)
at new App (/home/ibra/accor/astore/node_modules/@serverless-stack/resources/src/App.ts:141:5)
at Object.<anonymous> (/home/ibra/accor/astore/.build/run.js:68:13)
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:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
Frank
DebugStack
in your index.ts
, ie.
import * as sst from '@serverless-stack/resources'
export default function main(app: <http://sst.App|sst.App>): void {
console.log(app)
}
Run sst build
and see if console.log
is reached?Ibrael Espinosa
03/16/2022, 10:40 PMIbrael Espinosa
03/16/2022, 10:40 PMIbrael Espinosa
03/16/2022, 10:46 PMFrank
index.ts
, you’d still get the same error.Frank
Ibrael Espinosa
04/04/2022, 10:50 PMIbrael Espinosa
04/04/2022, 10:50 PMIbrael Espinosa
04/05/2022, 12:16 AMIbrael Espinosa
04/05/2022, 12:17 AMIbrael Espinosa
04/05/2022, 12:18 AM