Aws-sdk-js: CRC32CheckFailed: CRC32 integrity check failed

Created on 27 Aug 2017  路  7Comments  路  Source: aws/aws-sdk-js

I have a DynamoDB query which fails on Microsoft Edge with below version:

Microsoft Edge 40.15063.0.0
Microsoft EdgeHTML 15.15063

It was working perfectly in earlier versions of Edge. There is no issue with Chrome/Mozilla too.

I am using AWS.version: 2.6.9

I initilized DynamoDB as below:

var db = new AWS.DynamoDB();
var dc = new AWS.DynamoDB.DocumentClient();

I see below error in Edge console:

   {
      code: "CRC32CheckFailed",
      description: "",
      message: "CRC32 integrity check failed",
      name: "CRC32CheckFailed",
      number: 0,
      retryable: true,
      stack: "CRC32CheckFailed: CRC32 integrity check failed
   at checkCrc32 (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:27158)
   at callListeners (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:18438)
   at emit (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:18137)
   at emitEvent (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:6012)
   at e (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:1836)
   at a.prototype.runTo (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:36:23651)
   at Anonymous function (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:36:23811)
   at Anonymous function (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:2074)
   at Anonymous function (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:6040)
   at callListeners (https://sdk.amazonaws.com/js/aws-sdk-2.6.9.min.js:35:18544)",
      statusCode: 200
   }

405 #981

guidance

Most helpful comment

Thanks - worked for me using AWS-sdk with react-native

All 7 comments

@niteshvirani
This sounds suspiciously like a change in CORS support in the Edge browser.

Quick solution: Turn off crc32 checks in your Document Client by configuring the DynamoDB service you pass in with dynamoDbCrc32: false:
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#constructor-property
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property

The SDK checks the response body from DynamoDB by calculating a CRC32 hash and comparing it to the one DynamoDB sent in the x-amz-crc32 header. DynamoDB will gzip content that's sent once it exceeds a certain size (I'm not sure what that size is) and calculate the crc32 hash based on the gzipped payload. In browsers, we only have access to the response after it has been unzipped, so our CRC32 calculations won't match what DynamoDB calculates in these cases.

However, x-amz-crc32 is not an exposed header, meaning that browsers that support CORS should not recognize the header, and thus the SDK will skip this check. This is the behavior you're seeing in Chrome/Firefox. In Edge developer tools, can you share a screenshot of what your response headers look like from a DynamoDB response that causes this error?

Setting the configuration dynamoDbCrc32 to false tells the SDK to skip doing the CRC32 check, which should be helpful when you're running in a browser since this check won't work for larger payloads anyway. We should probably set this value to false when running in a browser context to catch cases like these.

Had the same problem at a Cordova/Ionic App in a Android 6 tablet. Using the dynamoDbCrc32: false option solved the issue.

Thanks - worked for me too, when using AWS Amplify.

import AWS from 'aws-sdk';

AWS.config.update({
  dynamoDbCrc32: false
});

Thanks - worked for me using AWS-sdk with react-native

Thanks @chrisradek . Worked for me with react-native same as @clarkgrg .

Looks like the suggestion here was helpful. As there isn't an problem with the SDK itself, I'm going to close this issue.

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