Skip to content

undefined this.batches in restore #74

@totano

Description

@totano

when restoring a table the program crashes with this message

WARN: table [<table name>] will be overwritten.
Starting download. 6Kb remaining...
node_modules/aws-sdk/lib/request.js:31
            throw err;
            ^

TypeError: Cannot read property 'length' of undefined
    at DynamoRestore._checkTableReady (node_modules/dynamo-backup-to-s3/lib/dynamo-restore.js:284:28)
    at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:364:18)
    at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (node_modules/aws-sdk/lib/state_machine.js:14:12)
    at node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (node_modules/aws-sdk/lib/request.js:685:12)

looking at the source code it appears to be a synchronization issue between the s3 file download and the restore batch start, which is happening before while the batches array is still undefined

as a workaround, I raised the timeout on dynamo-restore.js line 109 to 5000
setTimeout(dynamodb.describeTable.bind(dynamodb, { TableName: this.options.table }, this._checkTableReady.bind(this)), 1000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions