terraform: increase S3 presigned URL TTL from 10 to 60 minutes#8849
Merged
Yopi merged 1 commit intopolarsource:mainfrom Jan 10, 2026
Merged
Conversation
Increases the files_presign_ttl from 600 seconds (10 minutes) to 3600 seconds (60 minutes) for both sandbox and production environments to provide longer access to signed URLs.
|
Someone is attempting to deploy a commit to the polar-sh Team on Vercel. A member of the Team first needs to authorize it. |
12 tasks
Yopi
approved these changes
Jan 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Summary
Related Issue: Fixes #8848
Issue #8745 changed the default
S3_FILES_PRESIGN_TTLin the server config file to 3600s from 600s to allow a longer time for large files to upload. Terraform is overwriting this config. This PR updates the Terraform variables to 3600 to match the code defaults.🎯 What
Changing Terraform variables.
🤔 Why
Changing the
S3_FILES_PRESIGN_TTLvariable from 600 to 3600 inpolar/server/config.py(PR) was not a sufficient change. Since environment variables take precedence over code defaults, the actual runtime value was 600 seconds. When testing, 10 minutes was not enough time for me or my peers when uploading files of 2.9gb and 7.9gb via the pre-signed URL on various WiFi connections.🔧 How
Updated
files_presign_ttlfrom "600" to "3600" in:This sets the
POLAR_S3_FILES_PRESIGN_TTLenvironment variable interraform/modules/render_service/main.tfto 3600 seconds (60 minutes),.Previously, Terraform was setting this environment variable to 600, which overrode the 3600 default in
server/polar/config.pyviasettings.S3_FILES_PRESIGN_TTL. With this change the environment varible matches the intended behaviour, anddownloadable,product_media, andorganization_avatarsinserver/polar/file/s3.pywill have pre-signed URLs lasting 1 hour as expected.Note:
server/polar/integrations/aws/s3/service.pyhas a hardcoded function parameter default ofpresign_ttl: int = 600. Since Terraform environment variables don't affect Python function parameter defaults, the invoice functionscreate_order_invoice(),get_order_invoice_url(),create_payout_invoice(),get_payout_invoice_url()will still have a 10 minute expiration time, unless that code is updated to explicitly usesettings.S3_FILES_PRESIGN_TTL🧪 Testing
A maintainer with Terraform Cloud access will need to apply these changes by running terraform apply in both the terraform/sandbox and terraform/production directories
uv run task testfor backend,pnpm testfor frontend)uv run task lint && uv run task lint_typesfor backend)Test Instructions
terraform planto verify the changesterraform applyto deploy the changes to sandbox/production🖼️ Screenshots/Recordings
📝 Additional Notes
✅ Pre-submission Checklist