sst / ion

SST v3
https://sst.dev
MIT License
1.88k stars 221 forks source link

Bug : Unable to deploy dynamo with localIndexes #1142

Open imdkbj opened 2 days ago

imdkbj commented 2 days ago

Working

const _stage = $app.stage

export const impersonateTable = new sst.aws.Dynamo(
  'DynamoImpersonate',
  {
    fields: {
      id: 'string',
      domain: 'string' //future use
      // expireAt: 'number'
      // app: 'string',
      // is_impersonate: 'boolean',
    },
    ttl: 'expireAt',
    primaryIndex: { hashKey: 'id', rangeKey: 'domain' },
    // localIndexes: {
    //   ExpiryIndex: { rangeKey: 'expireAt' }
    // },
    transform: {
      table: {
        billingMode: 'PAY_PER_REQUEST',
        deletionProtectionEnabled: true,
        name: `${_stage}-sso-impersonate`,
        pointInTimeRecovery: {
          enabled: false
        }
      }
    }
  },
  { protect: false }
)

Not working

const _stage = $app.stage

export const impersonateTable = new sst.aws.Dynamo(
  'DynamoImpersonate',
  {
    fields: {
      id: 'string',
      domain: 'string', //future use
      expireAt: 'number'
      // app: 'string',
      // is_impersonate: 'boolean',
    },
    ttl: 'expireAt',
    primaryIndex: { hashKey: 'id', rangeKey: 'domain' },
    localIndexes: {
      ExpiryIndex: { rangeKey: 'expireAt' }
    },
    transform: {
      table: {
        billingMode: 'PAY_PER_REQUEST',
        deletionProtectionEnabled: true,
        name: `${_stage}-sso-impersonate`,
        pointInTimeRecovery: {
          enabled: false
        }
      }
    }
  },
  { protect: false }
)

Even error is wrong

yarn deploy:dev
yarn run v1.22.21
$ sst deploy --stage=dev
SST 3.0.122  ready!

➜  App:        sso
   Stage:      dev

~  Deploy

|  Error       CognitoHandlerFunction aws:lambda:Function
|    sdk-v2/provider2.go:457: sdk.helper_schema: handler and runtime must be set when PackageType is Zip: provider=aws@6.51.0
|  Error       DynamoImpersonateTable aws:dynamodb:Table
|  handler and runtime must be set when PackageType is Zip

✕  Failed    
   CognitoHandlerFunction aws:lambda:Function
     sdk-v2/provider2.go:457: sdk.helper_schema: handler and runtime must be set when PackageType is Zip: provider=aws@6.51.0
   DynamoImpersonateTable aws:dynamodb:Table
   handler and runtime must be set when PackageType is Zip

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.