Howdy folks! I have a problem where cdk/sst don't ...
# help
Howdy folks! I have a problem where cdk/sst don't want to deploy my stack any longer, complaining that the stack contains no resources. It used to work and I can't really think of any relevant changes (short of updating to use latest version). I get this error in `sst-debug.log`:
Copy code
Stack test-peasy-cognito
[2021-08-25T15:38:18.392] [INFO] default -   Status: failed
[2021-08-25T15:38:18.392] [INFO] default -   Error: The test-peasy-cognito stack contains no resources.
[2021-08-25T15:38:18.393] [ERROR] default - Cannot convert undefined or null to object
My stack looks like this:
Copy code
import * as cdk from '@aws-cdk/core'
import * as sst from '@serverless-stack/resources'
import * as cognito from '@aws-cdk/aws-cognito'
import * as apigAuthorizers from '@aws-cdk/aws-apigatewayv2-authorizers'

/** Manages the cdk-portions of the `cognito` resource. */
export default class CognitoStack extends sst.Stack {
  constructor (scope, id, props) {
    super(scope, id, props)

    // Cognito authorizers taken from Serverless definitions
    this.userPool = cognito.UserPool.fromUserPoolId(this, 'existingUserPool', cdk.Fn.importValue(`${scope.stage}-CognitoUserPoolId`))
    this.userPoolClient = cognito.UserPoolClient.fromUserPoolClientId(this, 'existingUserPoolClient', cdk.Fn.importValue(`${scope.stage}-CognitoUserPoolClientId`))
    this.userPoolAuthorizer = new apigAuthorizers.HttpUserPoolAuthorizer({
      userPool: this.userPool,
      userPoolClient: this.userPoolClient
As you can see, this is bringing in an existing pool that was previously created by serverless.
includes this bit:
this.cognitoStack = new CognitoStack(app, 'cognito')
If you have ideas or pointers, that would be much appreciated! 🙏
A recent update we made removed some default content that was placed in a stack which broke the ability to have empty stacks because CDK disallows this. I'm working on a fix for this tomorrow but in the meantime if you create a dummy resource in here it'll let you deploy. Think maybe you can just do
and add an output
Awesome, thanks for the pointer! 🙏
Unfortunately adding an output was not enough, will rollback to an earlier version, do you know when this was changed by chance?
FYI: I rolled back to
and that got me past this problem
Hey @PĂ„l Brattberg, just pushed out 0.40.3 with the fix. Give it a try!
Worked wonders, thanks @Frank!