aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.96k stars 556 forks source link

Submit job request processing entire bucket. #6157

Closed LeoReubelt closed 1 week ago

LeoReubelt commented 3 weeks ago

Checkboxes for prior research

Describe the bug

I have an application that uses Health Imaging. And I have a lambda that starts import jobs with the following function.

         const command = new StartDICOMImportJobCommand({
            clientToken: uuid.v4(),
            inputOwnerAccountId: "",
            datastoreId: dataStoreId,
            dataAccessRoleArn:
                'arn:aws:iam::' +
                process.env.ACCOUNT +
                ':role/ADD_DICOM_TO_DATASTORE_ROLE-' +
                process.env.ENV,
            inputS3Uri: inputPath,
            outputS3Uri: outputPath,
            jobName: awsRequestId,
         });

        const response = await client.send(command);

I enter a specific folder for inputS3Uri. And it has been working great. But I started getting the following error.

DICOM import job has failed.
FILE_COUNTS_LIMIT_EXCEED: Input bucket contains more than 5000 files.

And it seems like it is processing the entire bucket. Not just the folder that I pass in. If I go to the Data Store import job in the console and click on the link for the 'Import source location in S3', i get the following error...

The bucket named "xxxxxx" can't be found in the US East (Ohio) us-east-2 Region. The bucket named "xxxxx" is in the US East (N. Virginia) us-east-1 Region.

And then it redirects to the correct bucket, but not to the folder specified and not to the root, but to a folder in between. I have confirmed that the path is correct and that the files at the path exist. Also everything in our application is us-east-1. There are no references to us-east-2. And I am explicitly specifying us-east-1 when the clients are created.

const s3 = new AWS.S3({
    region: process.env.REGION,
});
const ahi = new AWS.MedicalImaging({
    region: process.env.REGION,
});

So, why is health imaging processing the entire bucket, and where is it getting us-east-2 from? I also tried this with the v2 sdk and got the same results.

SDK version number

@aws-sdk/client-medical-imaging@3.414.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v16.14.0

Reproduction Steps

See above

Observed Behavior

Specifying a folder in an s3 bucket that contains files to submit as a health imaging import job does not work. More files than are actually in that folder are submitted.

Expected Behavior

Only the files in the specified folder would be submitted.

Possible Solution

No response

Additional Information/Context

No response

aBurmeseDev commented 3 weeks ago

Hi @LeoReubelt - thanks for reaching out.

I attempted to reproduce it with the similar code below and was unable to. I passed the region into client as you can see. Here's order of precedence for setting the region in v3. I would suggest double checking lambda function, your env variables where region is set and lastly try setting region in client constructor.

import { MedicalImagingClient, StartDICOMImportJobCommand } from "@aws-sdk/client-medical-imaging";
const client = new MedicalImagingClient({region: "us-west-2"});
const input = { 
  jobName: "STRING_VALUE",
  dataAccessRoleArn: "STRING_VALUE",
  clientToken: "STRING_VALUE",
  datastoreId: "STRING_VALUE",
  inputS3Uri: "STRING_VALUE", 
  outputS3Uri: "STRING_VALUE", 
  inputOwnerAccountId: "STRING_VALUE",
};
const command = new StartDICOMImportJobCommand(input);
const response = await client.send(command);

Let me know if issue persists and I'd be happy to further look into it.

github-actions[bot] commented 2 weeks ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

LeoReubelt commented 1 week ago

ff