Report this

What is the reason for this report?

DO Spaces: ERROR InvalidDigest when s3:nodejs_sdk:putObject with ContentMD5 provided

Posted on August 2, 2019

Hi,

I wish to use ContentMD5 to insure integrity check for putObject and getObject.

But Spaces always response 400:InvalidDigest when ContentMD5 supplied.

The Spaces client I’m using is https://www.npmjs.com/package/aws-sdk

and following is the code for putting object


  params =
    Body: content
    ContentMD5 : crypto.createHash('md5').update(content).digest("hex")
    Bucket: S3_BUCKET_PARAMS,
    ContentType : contentType || "application/json"
    Key: remotePath

  log "[putString] params:", params

  S3Client.putObject params, (err, data) ->
    if err?
      log "[putJsonObject] ERROR:#{err}"
      return callback(err)

    log "[putJsonObject] data:", data
    return callback null, data
  return


and following is the log

-->
 [putString] params: { Body: '{"haha":"nothing"}',
  ContentMD5: 'e829496f87c60b176b2f288020648348',
  Bucket: 'aaa-bbb',
  ContentType: 'application/json',
  Key: '11111/2019/11/09' } +0ms


<--
 err: { InvalidDigest: null
  message: null,
  code: 'InvalidDigest',
  region: null,
  time: 2019-08-02T07:29:39.644Z,
  requestId: 'tx0000000000001e2c28c77-005d43e662-284cc8-sgp1a',
  extendedRequestId: undefined,
  cfId: undefined,
  statusCode: 400,
  retryable: false,
  retryDelay: 96.90178409690691 }



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey there,

Without full request and response headers, it is difficult for us to say if this is an issue on the client end or the backend with Spaces. Could you write in a ticket to our team:

https://do.co/new-ticket

With those details so we can investigate? Alternatively, you can write those details in here with redacted secrets and we can look to help.

Regards, Ethan Fox Developer Support Engineer II - DigitalOcean

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.