Failed to restore data after migrating Discourse

Yes, there seems to be an incompatibility with R2.

Untested, but you could try this:

Environment variables are set in your container’s app.yml under the env block — the same place you already have things like DISCOURSE_S3_ACCESS_KEY_ID. Just add the two vars there:

env:
  LANG: en_US.UTF-8
  # ... your existing vars ...
  DISCOURSE_S3_BUCKET: your-r2-bucket
  DISCOURSE_S3_ACCESS_KEY_ID: ...
  DISCOURSE_S3_SECRET_ACCESS_KEY: ...
  DISCOURSE_S3_ENDPOINT: https://<account>.r2.cloudflarestorage.com

  # Fix for Cloudflare R2 checksum incompatibility with aws-sdk-s3
  AWS_REQUEST_CHECKSUM_CALCULATION: when_required
  AWS_RESPONSE_CHECKSUM_VALIDATION: when_required

Then rebuild the container:

./launcher rebuild app