Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Can't set custom name for my json file #84

Open
seta-hungDang opened this issue Sep 25, 2020 · 0 comments
Open

Can't set custom name for my json file #84

seta-hungDang opened this issue Sep 25, 2020 · 0 comments

Comments

@seta-hungDang
Copy link

seta-hungDang commented Sep 25, 2020

So here is my code

    const data = JSON.stringify(sentences);

    const userInfoInCookie = getCookie("userInfo");
    const orgId = userInfoInCookie
      ? JSON.parse(userInfoInCookie).organizationId
      : null;
    const date = new Date();
    amazonS3Config.dirName = "org_" + orgId + "/transcript/" + date.getTime();

    S3FileUpload.uploadFile(data, amazonS3Config)
      .then((data) => console.log("dataUri", data))
      .catch((err) => console.error(err));

And here is what I get from S3:

{
  "bucket": "salf-dev",
  "key": "org_2/transcript/1601031750699.json/undefined",
  "location": "https://salf-dev.s3.amazonaws.com/org_2/transcript/1601031750699.json/undefined",
  "result": {}
}

The url in location works but org_2/transcript/1601031750699.json/undefined has the ***.json as a folder, not file name. What can I do so that my file works. Thank a bunch!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant