nitrictech/nitric

Unable to list files from s3 bucket

davemooreuws opened this issue · 3 comments

Bug Report

Issue

I am using the Node SDK 0.10.0 to try list the files of a bucket on AWS.

import { api, bucket } from "@nitric/sdk";

const helloApi = api("main");
const profiles = bucket("profiles").for("reading", "writing", "deleting");

helloApi.get("/files", async (ctx) => {
  try {
    const files = await profiles.files();

    console.log(files);

    return ctx.res.json({
      files,
    });
  } catch (e) {
    return ctx.res.json({
      error: e,
    });
  }
});

Steps

Steps to reproduce the behavior:

  1. use the typescript example template
  2. add the above code
  3. deploy to AWS
  4. attempt to retrieve the files via the /files GET endpoint

Expected

should return an empty array like it does on GCP

Output of nitric info -o yaml:

{
  "os": "windows",
  "arch": "amd64",
  "goVersion": "go1.18.10",
  "cliVersion": "1.15.0",
  "fabricVersion": "v0.22.0",
  "containerRuntime": "docker",
  "containerRuntimeVersion": "platform:\n  name: Docker Desktop 4.11.1 (84025)\ncomponents:\n- name: Engine\n  version: 20.10.17\n  details:\n    ApiVersion: \"1.41\"\n    Arch: amd64\n    BuildTime: \"2022-06-06T23:01:23.000000000+00:00\"\n    Experimental: \"false\"\n    GitCommit: a89b842\n    GoVersion: go1.17.11\n    KernelVersion: 5.4.72-microsoft-standard-WSL2\n    MinAPIVersion: \"1.12\"\n    Os: linux\n- name: containerd\n  version: 1.6.6\n  details:\n    GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1\n- name: runc\n  version: 1.1.2\n  details:\n    GitCommit: v1.1.2-0-ga916309\n- name: docker-init\n  version: 0.19.0\n  details:\n    GitCommit: de40ad0\nversion: 20.10.17\napiversion: \"1.41\"\nminapiversion: \"1.12\"\ngitcommit: a89b842\ngoversion: go1.17.11\nos: linux\narch: amd64\nkernelversion: 5.4.72-microsoft-standard-WSL2\nexperimental: false\nbuildtime: \"2022-06-06T23:01:23.000000000+00:00\"\n",
  "detectedErrors": []
}

Other info

In the Node SDK, data is undefined from the this.storage.StorageServiceClient.listFiles call

Resolved permission issue in: #397

Release in dev providers (needs prod release of CLI & providers to be available).

released to nitric aws provider v0.23.0