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.

listObjects for bucket with "folders" results in TypeError: xmlobj.CommonPrefixes.forEach is not a function

See original GitHub issue

When we call client.listObjects("someBucketName") for a bucket that contains a “folder” (i.e. an object with a trailing slash), the callback actually hangs! When we hack xml-parsers.parseListObjectsQuery to wrap the body with a try/catch, we see:

TypeError: xmlobj.CommonPrefixes.forEach is not a function
    at parseListObjects (xml-parsers.js:382)

further modifying that function to print out xmlobj.CommonPrefixes gives:

{Prefix: "f1/"}

We see this in 7.0.17.

With 7.0.18, the client still hangs, but now the hanging exception is:

TypeError: xmlobj.Contents.forEach is not a function
    at parseListObjects (xml-parsers.js:388)

I suspect that 7.0.18 just has more bugs, because CommonPrefixes is still not forEach-able, in 7.0.18; it’s still not an array:

{Prefix: "f1/"}

Related? https://github.com/minio/minio-js/issues/886

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
starpitcommented, Feb 5, 2021

I just checked, and this seems to be fixed on master. Can we expect a release on npm sometime soon? Thanks.

1reaction
gitzjpcommented, Jun 10, 2021

I just checked, and this seems to be fixed on master. Can we expect a release on npm sometime soon? Thanks.

I had the same problem and i solved it using listObjectsV2().

Read more comments on GitHub >

github_iconTop Results From Across the Web

listObjects for bucket with "folders" results in TypeError: xmlobj ...
listObjects for bucket with "folders " results in TypeError: xmlobj.CommonPrefixes.forEach is not a function.
Read more >
aws s3 sdk list objects by multiple prefixes - node.js
I have this same issue and couldn't change the key prefixes. It's pretty easy to do multiple calls, just create a prefixes array...
Read more >
Amazon S3 and PHP | How to list only top level folders in a ...
This will list only the top level folder. If we do not use delimiter with listObject function then it will give list of...
Read more >
List files and folders of AWS S3 bucket using prefix & delimiter
Every file that is stored in s3 is considered as an object. Each Amazon S3 object has file content, key (file name with...
Read more >
Viewing online file analysis results for 'mongodumpxp.exe'
Name Ordinal Address ??0Arg@pcrecpp@@QAE@PAD@Z #1 0x479fc0 ??0Arg@pcrecpp@@QAE@PADP6A_NPBDHPAX@Z@Z #2 0x47a0e0 ??0Arg@pcrecpp@@QAE@PAE@Z #3 0x479fc0
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