CodexBloom - AI-Powered Q&A Platform

OCI Object Storage: Handling 'Not Found' Error When Accessing Files with Pre-signed URLs

👀 Views: 2 💬 Answers: 1 📅 Created: 2025-06-09
oci object-storage presigned-url

I'm facing an issue when trying to access files stored in OCI Object Storage using pre-signed URLs. I have configured the storage bucket correctly and generated the URLs using the SDK, but when I try to access them, I receive a '404 Not Found' error. Here's the code snippet I'm using to generate the pre-signed URL: ```python import oci config = oci.config.from_file() bucket_name = 'my-bucket' object_name = 'my-file.txt' namespace = 'my_namespace' client = oci.object_storage.ObjectStorageClient(config) pre_signed_url = client.generate_presigned_url( 'GET', namespace_name=namespace, bucket_name=bucket_name, object_name=object_name, expiration_seconds=3600 ) print(pre_signed_url) ``` I've verified that the bucket and object names are correct, and that the object exists in the specified bucket. However, when I access the printed URL in the browser, I get '404 Not Found'. I've checked the permissions and the pre-signed URL is being generated without errors. Additionally, I noticed that the object is in a different compartment than the one I'm currently authenticated with, but I'm not sure if that would affect the ability to generate the pre-signed URL or access it. Any insights on what might be going wrong here? Is there something specific I might be missing in my configuration or permissions?