question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

statObject always returns "'AccessDenied"

See original GitHub issue

Hi guys, I get a very strange error every time I call the statObject method of the client. All the rest works exactly as expected. I use a very basic example and I have minio running into a docker container. I am using node v13.9.0 and the last version of minio-js. This is the script:

var Minio = require('minio')
var minioClient = new Minio.Client({
    endPoint: 'minio.mydomain.com',
    port: 443,
    useSSL: true,
    accessKey: 'MY_KEY',
    secretKey: 'MY_SECRET'
});

const bucket = 'my-bucket'
const file = '8c024f6b-f2d6-4f04-9791-9e95435c1f66.pdf'

minioClient.statObject(bucket, file, function(err, stat) {
  if (err) {
    return console.log(err)
  }
  console.log(stat);

})

And the error I get is:


S3Error: Valid and authorized credentials required
    at getError (/tmp/minio/node_modules/minio/dist/main/transformers.js:138:15)
    at /tmp/minio/node_modules/minio/dist/main/transformers.js:150:14
    at DestroyableTransform._flush (/tmp/minio/node_modules/minio/dist/main/transformers.js:80:10)
    at DestroyableTransform.prefinish (/tmp/minio/node_modules/readable-stream/lib/_stream_transform.js:129:10)
    at DestroyableTransform.emit (events.js:321:20)
    at prefinish (/tmp/minio/node_modules/readable-stream/lib/_stream_writable.js:611:14)
    at finishMaybe (/tmp/minio/node_modules/readable-stream/lib/_stream_writable.js:620:5)
    at endWritable (/tmp/minio/node_modules/readable-stream/lib/_stream_writable.js:643:3)
    at DestroyableTransform.Writable.end (/tmp/minio/node_modules/readable-stream/lib/_stream_writable.js:571:22)
    at IncomingMessage.onend (_stream_readable.js:673:10) {
  code: 'AccessDenied',
  amzRequestid: null,
  amzId2: null,
  amzBucketRegion: null

I found also something here https://github.com/minio/minio-py/issues/828 that unfortunately did not help me. Really thanks in advance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tonmannacommented, Jun 2, 2021

Thanks @xsfour It works fine for me. But I have another issue with my infrastructure. I use Cloudflare in front of Nginx. I add page rules for bypass cache to solve this problem.

1reaction
kannappanrcommented, Apr 4, 2020

@lukesmolo Can you please enable tracing on the client side.

var Minio = require('minio')
var minioClient = new Minio.Client({
    endPoint: 'minio.mydomain.com',
    port: 443,
    useSSL: true,
    accessKey: 'MY_KEY',
    secretKey: 'MY_SECRET'
});

const bucket = 'my-bucket'
const file = '8c024f6b-f2d6-4f04-9791-9e95435c1f66.pdf'
minioClient.traceOn(process.stdout)
minioClient.statObject(bucket, file, function(err, stat) {
  if (err) {
    return console.log(err)
  }
  console.log(stat);

})

Also, if the backend is minio, you can run mc admin trace -v alias against the minio backend.

Also, can you remove the port from the constructor and try the script

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access Denied error when using an S3 static website endpoint
If an Access Denied error is returned by the web browser or cURL command, ... An explicit deny statement will always override an...
Read more >
Hi, how to prevent Caddy convert HEAD to GET requests - Help
And when I saw Caddy logs, the request method was shown as GET. This bug is same as statObject always returns “'AccessDenied” ·...
Read more >
minio - Bountysource
statObject always returns "'AccessDenied" $ 0. Created 2 years ago in minio/minio-js with 6 comments. Hi guys, I get a very strange error ......
Read more >
.NET Client API Reference — MinIO Object Storage for Linux
Creates MinIO client object with given endpoint.AccessKey, secretKey, region and sessionToken are optional parameters, and can be omitted for anonymous access.
Read more >
Why is my access denied on s3 (using the aws-sdk for Node.js)?
The problem was that my new IAM user didn't have a policy attached to it. I assigned it the AmazonS3FullAccess policy and now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found