diff --git a/apps/docs/content/guides/storage/s3/authentication.mdx b/apps/docs/content/guides/storage/s3/authentication.mdx index b6a09be55550e..55c5102fccedb 100644 --- a/apps/docs/content/guides/storage/s3/authentication.mdx +++ b/apps/docs/content/guides/storage/s3/authentication.mdx @@ -25,6 +25,14 @@ This is all the information you need to connect to Supabase Storage using any S3 Storage S3 Access keys + + +For optimal performance when uploading large files you should always use the direct storage hostname. This provides several performance enhancements that will greatly improve performance when uploading large files. + +Instead of `https://project-id.supabase.co` use `https://project-id.storage.supabase.co` + + + @@ -86,7 +94,7 @@ const { const client = new S3Client({ forcePathStyle: true, region: 'project_region', - endpoint: 'https://project_ref.supabase.co/storage/v1/s3', + endpoint: 'https://project_ref.storage.supabase.co/storage/v1/s3', credentials: { accessKeyId: 'project_ref', secretAccessKey: 'anonKey', diff --git a/apps/docs/content/guides/storage/uploads/resumable-uploads.mdx b/apps/docs/content/guides/storage/uploads/resumable-uploads.mdx index d12d1cc692471..a7ac47b3031d8 100644 --- a/apps/docs/content/guides/storage/uploads/resumable-uploads.mdx +++ b/apps/docs/content/guides/storage/uploads/resumable-uploads.mdx @@ -14,6 +14,14 @@ The resumable upload method is recommended when: Supabase Storage implements the [TUS protocol](https://tus.io/) to enable resumable uploads. TUS stands for The Upload Server and is an open protocol for supporting resumable uploads. The protocol allows the upload process to be resumed from where it left off in case of interruptions. This method can be implemented using the [`tus-js-client`](https://github.com/tus/tus-js-client) library, or other client-side libraries like [Uppy](https://uppy.io/docs/tus/) that support the TUS protocol. + + +For optimal performance when uploading large files you should always use the direct storage hostname. This provides several performance enhancements that will greatly improve performance when uploading large files. + +Instead of `https://project-id.supabase.co` use `https://project-id.storage.supabase.co` + + + { var upload = new tus.Upload(file, { - endpoint: `https://${projectId}.supabase.co/storage/v1/upload/resumable`, + // Supabase TUS endpoint (with direct storage hostname) + endpoint: `https://${projectId}.storage.supabase.co/storage/v1/upload/resumable`, retryDelays: [0, 3000, 5000, 10000, 20000], headers: { authorization: `Bearer ${session.access_token}`, @@ -125,7 +134,7 @@ Supabase Storage implements the [TUS protocol](https://tus.io/) to enable resuma // Initialize Uppy instance only once const [uppy] = useState(() => new Uppy()); // Initialize Supabase client with project URL and anon key - const supabase = createClient(projectURL, anonKey); + const supabase = createClient(`https://${projectId}.supabase.co`, anonKey); useEffect(() => { const initializeUppy = async () => { @@ -135,7 +144,8 @@ Supabase Storage implements the [TUS protocol](https://tus.io/) to enable resuma } = await supabase.auth.getSession(); uppy.use(Tus, { - endpoint: `${projectURL}/storage/v1/upload/resumable`, // Supabase TUS endpoint + // Supabase TUS endpoint (with direct storage hostname) + endpoint: `https://${projectId}.storage.supabase.co/storage/v1/upload/resumable`, retryDelays: [0, 3000, 5000, 10000, 20000], // Retry delays for resumable uploads headers: { authorization: `Bearer ${session?.access_token}`, // User session access token