XML error in Postgres s3 backup template
victorgranda14
HOBBYOP

2 months ago

Hello,

I'm having an issue trying to upload my postgres db backup to my s3 service. Apparently the env. variables are configured correctly, but I get this message in the deploy logs (see image with the logs).

What else could it be causing this error?

Thank you.

Solved$10 Bounty

19 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


brody
EMPLOYEE

2 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 2 months ago


idiegea21
HOBBY

2 months ago

This error usually happens when S3 bucket config is malformed, most often from a region mismatch or wrong endpoint/bucket name. On Railway, double-check that your AWS_REGION exactly matches the region of your bucket, and that S3_BUCKET contains only the plain bucket name (all lowercase, no slashes or special characters).

If you’re using a non-AWS provider (like DigitalOcean, Wasabi, etc.), make sure S3_ENDPOINT is just the base URL (e.g. https://s3.us-west-1.wasabisys.com) without adding the bucket name. Fixing the region/endpoint alignment almost always resolves the MalformedXML backup error.


victorgranda14
HOBBYOP

2 months ago

Hello, I have confirmed that the variables are OK, since the bucket name is in format: "xxx-xxx-xxx", same as the region. I'm not using any non-AWS provider either. What else it could be? I could share an example of the variables I'm using


victorgranda14

Hello, I have confirmed that the variables are OK, since the bucket name is in format: "xxx-xxx-xxx", same as the region. I'm not using any non-AWS provider either. What else it could be? I could share an example of the variables I'm using

What tool are you using for upload backups to S3?

I think the best way to help would be for you to share a repository with a minimal reproduction so we can try it out


crisog

What tool are you using for upload backups to S3?I think the best way to help would be for you to share a repository with a minimal reproduction so we can try it out

victorgranda14
HOBBYOP

2 months ago


victorgranda14

I'm using the railway template: https://github.com/railwayapp-templates/postgres-s3-backups.git

Please do share an example of the variables you're using


crisog

Please do share an example of the variables you're using

victorgranda14
HOBBYOP

2 months ago

AWS_ACCESS_KEY_ID="ACCESSKEYID" AWS_S3_BUCKET="example-bucket" AWS_S3_REGION="us-east-1" AWS_SECRET_ACCESS_KEY="SECRETACCESSKEY" BACKUP_CRON_SCHEDULE="0 5 * * *" BACKUP_DATABASE_URL="${{Postgres.DATABASE_URL}}" SUPPORT_OBJECT_LOCK="true" RUN_ON_STARTUP="true"


uxuz
MODERATOR

2 months ago

Hey, which Postgres version are you trying to backup? You may have to specify additional / change service variables if you are backing up Postgres 17. https://github.com/railwayapp-templates/postgres-s3-backups/blob/main/README.md


victorgranda14

AWS_ACCESS_KEY_ID="ACCESSKEYID" AWS_S3_BUCKET="example-bucket" AWS_S3_REGION="us-east-1" AWS_SECRET_ACCESS_KEY="SECRETACCESSKEY" BACKUP_CRON_SCHEDULE="0 5 * * *" BACKUP_DATABASE_URL="${{Postgres.DATABASE_URL}}" SUPPORT_OBJECT_LOCK="true" RUN_ON_STARTUP="true"

If you are not using AWS, I'd suggest using a custom AWS_S3_ENDPOINT and setting the AWS_S3_REGION=auto


crisog

If you are not using AWS, I'd suggest using a custom AWS_S3_ENDPOINT and setting the AWS_S3_REGION=auto

victorgranda14
HOBBYOP

2 months ago

But I'm using AWS directly, or are you suggesting should I use a non-AWS provider?


victorgranda14

But I'm using AWS directly, or are you suggesting should I use a non-AWS provider?

No, sorry, I misread a part of the conversation


Can you try running it with SUPPORT_OBJECT_LOCK="false" ?

Sorry for the back and forth, I'm running this myself trying to reproduce.


Finally got to reproduce it, I'll continue to debug to see if I can find the root cause

Attachments


crisog

Finally got to reproduce it, I'll continue to debug to see if I can find the root cause

victorgranda14
HOBBYOP

2 months ago

Great! I'll be looking forward to any feedback, thank you so much for the support. I tried with the support_object_lock=false but didn't work either, the same with the "auto" region. I'm using this version of postgres so the variable changes suggested by uxuz didn't solve the problem.


I forked the template and upgrading the version of the AWS SDK made it work. The current SDK version is pretty outdated and likely has issues.

I’ll open an issue on the template repo so it can get fixed


victorgranda14
HOBBYOP

2 months ago

Nice! how did you do the upgrade after forking?, thanks a lot for your help.


victorgranda14

Nice! how did you do the upgrade after forking?, thanks a lot for your help.

Just updated the package.json to a more updated version (could be latest 3.901.0) and run npm i. Push the changes.


victorgranda14
HOBBYOP

2 months ago

Thank you so much, it works now. Have a great day!


Status changed to Solved itsrems 2 months ago


brody
EMPLOYEE

2 months ago

I have also merged a PR to update the SDK on the template's GitHub repo.

https://github.com/railwayapp-templates/postgres-s3-backups/pull/38


Status changed to Solved brody 2 months ago


Loading...