Aws-sdk-js: invalidSignatureException: Signature not yet current from Pakistan region

Created on 4 Mar 2019  路  3Comments  路  Source: aws/aws-sdk-js

Problem
I got this error when i run that code. How can i setup my time according to Pakistan region

CODE

const AWS = require('aws-sdk');
AWS.config.update({ region : 'us-east-1' })
const dynamodb = new AWS.DynamoDB();
const item = {
    Item : {
        id : {
            S: (new Date()).getTime().toString()
        },
        value : {
            S: process.argv[2]
        }
    },
    TableName: 'aws-developer'
}
dynamodb.putItem(item,(err,res) => {
    if (err) throw err
})

ERROR :
InvalidSignatureException: Signature not yet current: 20190305T002809Z is still later than 20190304T214315Z (20190304T212815Z + 15 min.)

guidance

Most helpful comment

Hey @Usamaliaquat123

Can you check if your system clock is correct? You will see this exception when your local clock is ahead of the service clock. You can turn on the correctClockSkew config to solve this by const dynamodb = new AWS.DynamoDB({correctClockSkew: true}). There SDK will calculate the clock skew and apply the offset to the request automatically.

see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#correctClockSkew-property

All 3 comments

Hey @Usamaliaquat123

Can you check if your system clock is correct? You will see this exception when your local clock is ahead of the service clock. You can turn on the correctClockSkew config to solve this by const dynamodb = new AWS.DynamoDB({correctClockSkew: true}). There SDK will calculate the clock skew and apply the offset to the request automatically.

see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#correctClockSkew-property

but yes i checked my system clock it is all set according to my region. What about aws-cli get again same error..

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings