Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Changing client library to be retrieved via pre-signed URL for Cloud" #13558

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/backend-core/src/objectStore/buckets/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ export function clientLibraryPath(appId: string) {
* due to issues with the domain we were unable to continue doing this - keeping
* incase we are able to switch back to CDN path again in future.
*/
function cloudClientLibraryUrl(appId: string) {
export function clientLibraryCDNUrl(appId: string, version: string) {
let file = clientLibraryPath(appId)
return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file)
if (env.CLOUDFRONT_CDN) {
// append app version to bust the cache
if (version) {
file += `?v=${version}`
}
// don't need to use presigned for client with cloudfront
// file is public
return cloudfront.getUrl(file)
} else {
return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file)
}
}

export function clientLibraryUrl(appId: string, version: string) {
let tenantId, qsParams: { appId: string; version: string; tenantId?: string }
if (env.isProd() && !env.SELF_HOSTED) {
return cloudClientLibraryUrl(appId)
}
try {
tenantId = getTenantId()
} finally {
Expand Down