Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 bucket - Failed to get directory contents - No such file or directory: test-subfolder #221

Open
gregorycottone opened this issue Jan 20, 2025 · 0 comments

Comments

@gregorycottone
Copy link

gregorycottone commented Jan 20, 2025

After properly set the S3 bucket in the Advanced Settings Editor:

{
  "resources": [
    {
      "name": "s3 bucket",
      "url": "s3://test-bucket"
    }
  ]
}

The jupyter-fs icon appears on the left bar of the jupyterlab UI, then, if I click it, I can properly see the files and subfolders inside the bucket.

The issue appears when I try to open one of the subfolders inside the S3 bucket.
Indeed what I get is a "Failed to get directory contents - No such file or directory: test-subfolder" error message.

So, let's suppose I have an S3 bucket called "test-bucket" that contains one file called "test-file" and one subfolder called "test-subfolder", I'm able to open the "test-bucket" via jupyter-fs icon, I'm also able to open the "test-file", but I'm not able to open the "test-subfolder", indeed when I click in the + icon next to the "test-subfolder", I get the message:

"Failed to get directory contents - No such file or directory: test-subfolder"

By checking the networking tab of the inspect tools of the browser I see a 404 Not Found error:

Request URL: https://my-domain-name/user/user-name/api/contents/4eba04d6%3Atest-subfolder?content=1&hash=0&1737376389969
Request Method: GET
Status Code: 404 Not Found
Response body: {"message": "No such file or directory: test-subfolder", "reason": null}

Now, I'm sure that the "test-subfolder" folder from the "test-bucket" S3 bucket contains files, either because I have access to the S3 bucket and I can see what's inside from the AWS S3 console, but also because if I run the following code snippet from a notebook running on jupyterlab:

import boto3

bucket_name = 'test-bucket'
s3 = boto3.client('s3')
response = s3.list_objects_v2(Bucket=bucket_name)
print(response)

I can print the list of all the files inside the "test-bucket" bucket.

Also, if I run this command from the terminal of jupyterlab: aws s3 ls s3://test-bucket/ --recursive I can see the list of all the files stored inside the "test-subfolder" folder.

A last important information is that if I set the following configuration in the Advance Settings Editor:

{
  "resources": [
    {
      "name": "s3 bucket",
      "url": "s3://test-bucket/test-subfolder/"
    }
  ]
}

Then I can see the list of files contained in the S3 bucket from the jupyter-fs icon.

Here a screenshot of the error I get (note the name of the subfolder is not "test-subfolder", but "textract_output".
Image

Desktop (please complete the following information):

  • OS of the machine running jupyter: [Amazon Linux 2023]
  • Browser [Microsoft Edge]
  • Version [jupyter-fs==1.0.0.post1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant