MongoDB backup failed "upload file: write data: upload to S3: SerializationError"


I can’t get MongoDB backup to work with Percona Operator on Kubernetes.
I’d be grateful for any help.

I’m getting these logs after applying on-demand backup:

>>> kubectl logs -n mongodb-percona pod/my-cluster-name-rs0-0 -c backup-agent
mark RS as error upload data files: upload file /data/db/key.db/WiredTigerLog.0000000010: upload file: write data: upload to S3: SerializationError: failed to decode REST XML response status code: 200, request id: caused by: XML syntax error on line 1: attribute name without = in element.:

full log.txt (3.5 KB)

Kubernetes is hosted on DigitalOcean and S3 bucket is also hosted there.

Steps to Reproduce:

I have this cr.yaml file:
cr.txt (4.1 KB)

And this is the backup I’m trying to do:
on-demand-backup.txt (212 Bytes)
The automated backup defined in cr.yaml also doesn’t work.

Additional info

Hi @pepa!
Try to reconfigure the backup section with:

  1. endpointUrl:
  2. region: us-east-1

Thanks for your reply.
I tried your solution on Civo cloud, it worked there.

But when I use it on DigitalOcean, it gives me 400 status code:

check storage connection: storage check failed with: get S3 object header: BadRequest: Bad Request
        status code: 400, request id: tx0000092fdbe2c55ac20ae-006665a7eb-fa4b23ec-fra1b, host id:

Btw DigitalOcean’s URL for bucket is:

I could eventually go to Civo, but I would like to stay at DigitalOcean if possible.
Is there anything else I could try?

Hi @pepa
I would suggest trying to set forcepathstyle option to false if digitalocean requires bucket name in endpointUrl

I have set it up like this and I’m no longer getting 400 error:

        type: s3
          bucket: "appname-mongodb-backups"
          credentialsSecret: my-cluster-name-backup-s3
          region: fra1
          forcePathStyle: false

I didn’t know about forcePathStyle, because it’s not documented in Custom Resource options - Percona Operator for MongoDB.

But the original problem remain - I’m still facing the serialization error. So I’ll be storing backups on Civo S3 (and maybe moving Kubernetes there as well) if this error can’t be resolved as it seems to only happen on DigitalOcean.

Hi @pepa!
I meant your settings should be like:

          bucket: appname-mongodb-backups
          region: us-east-1
          forcePathStyle: true


          region: us-east-1
          forcePathStyle: false

When I use the first settings I get 400 error.

In the second settings the bucket is required. After applying cr.yml I get:
The PerconaServerMongoDB "my-cluster-name" is invalid: spec.backup.storages.s3-appname.s3.bucket: Required value