minio-js icon indicating copy to clipboard operation
minio-js copied to clipboard

Presigned URL is giving an error on dev environment - AnonymousRequestError: Presigned GET url cannot be generated for anonymous requests

Open nikhilguptagl opened this issue 1 year ago • 1 comments

NOTE

If this case is urgent, please subscribe to Subnet so that our 24/7 support team may help you faster.

I am using presigned URL with this chunk of code -

try {
      const dataStream = await MinIO.presignedGetObject(
        bucketName,
        objectName,
        24 * 60 * 60
      );
      const response = await axios.get(dataStream, { responseType: "stream" });
      let xmlContent = "";
      for await (const chunk of response.data) {
        xmlContent += chunk.toString();
      }
      res.send({ fileObject: btoa(xmlContent) });
    } catch (error) {
      res.send({ message: `${ERRORMESSAGE_3} ${error}` });
      return null;
    }

On local machine when connected to minio in dev environment, it is working fine, but when application gets deployed to dev environment - it throws an error while fetching the assets from minio - AnonymousRequestError: Presigned GET url cannot be generated for anonymous requests

Minio config - endPoint: 'endpoint.name', port: 9000, useSSL: false, accessKey: 'accesskey', secretKey: 'secretKey',

nikhilguptagl avatar Sep 19 '24 14:09 nikhilguptagl