CoorpAcademy / serverless-plugins

Collection of serverless plugins :zap:
231 stars 131 forks source link

dynamodb offline streams - this._waitFor is not a function #145

Open rcoundon opened 4 years ago

rcoundon commented 4 years ago

When the _describeTable method throws an error, the catch block references this._waitFor() which isn't a function Line 58 in dynamodb-streams.js

  async _describeTable(tableName) {
    try {
      await this.client.waitFor('tableExists', {TableName: tableName}).promise();
      return await this.client
        .describeTable({
          TableName: tableName
        })
        .promise();
    } catch (err) {
      return this._waitFor(tableName);
    }

Maybe this should be:

  async _describeTable(tableName) {
    try {
      await this.client.waitFor('tableExists', {TableName: tableName}).promise();
      return await this.client
        .describeTable({
          TableName: tableName
        })
        .promise();
    } catch (err) {
      return this.client.waitFor(tableName);
    }
  }
AdrieanKhisbe commented 4 years ago

Hello @rcoundon, a fix as been released via #148, you can try ~serverless-offline-kinesis@4.2.0~ serverless-offline-dynamodb-streams@4.2.0

Please tell me if it solves the issue for you

rcoundon commented 4 years ago

Thanks @AdrieanKhisbe - I'll give this a go in the next day or two when I'm back in front my computer. Does this mean I also need the serverless-offline-kinesis plugn in addition to serverless-offline-dynamodb-streams ?

AdrieanKhisbe commented 4 years ago

@rcoundon take your time :)

No it's just they had both the same issue, and I mixed things up in my message. :facepalm:

No need to kinesis, Just bump serverless-offline-dynamodb-streams, v4.2.0 also :)

rcoundon commented 4 years ago

@rcoundon take your time :)

No it's just they had both the same issue, and I mixed things up in my message. 🤦

No need to kinesis, Just bump serverless-offline-dynamodb-streams, v4.2.0 also :)

Ah - brilliant - thanks!