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

aws-glue-alpha: Undefined behavior of Code.fromAsset API #26469

Closed
protyay opened this issue Jul 21, 2023 · 3 comments
Closed

aws-glue-alpha: Undefined behavior of Code.fromAsset API #26469

protyay opened this issue Jul 21, 2023 · 3 comments
Labels
@aws-cdk/aws-glue Related to AWS Glue bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@protyay
Copy link

protyay commented Jul 21, 2023

Describe the bug

I'm trying to upload a Glue Job from local Disk. The glue job currently lies in assets folder in the CDK package. I've the following code for creating a glue job out of that script

private readonly ASSET_PATH = path.join(__dirname, `/../assets/jobName.scala`);
...
....
....
new glue.Job(this, 'SparkScalaETLJob', {
      executable: glue.JobExecutable.scalaEtl({
        glueVersion: glue.GlueVersion.V3_0,
        script: glue.Code.fromAsset(this.ASSET_PATH),
        className: 'GlueApp',
      }),
      workerType: glue.WorkerType.G_1X,
      workerCount: 10,
      description: 'Glue ETL Job',
      defaultArguments,
    });

When i run brazil-build, this is the issue I get

Error: ENOTDIR: not a directory, lstat '/Volumes/.../src/CDKPackage/dist/lib/assets/ETLJob.scala'
So, i thought i might have to point to the directory, in which case, I get the following error

Code path /Volumes/workplace/DeveloperRiskWorkflow/src/DeveloperRiskWorkflowCDK/lib/assets is a directory. Only files are supported

Expected Behavior

Code.fromAsset must work properly when the Asset Path points to a fileName, because the source code throws an error if the Asset path is a directory.

Current Behavior

Already mentioned in Bug Section

Reproduction Steps

Mentioned in the Bug Scenario

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

ENOTDIR: not a directory

Framework Version

No response

Node.js Version

18.16.1

OS

MacOS 13.3.1

Language

Typescript

Language Version

No response

Other information

No response

@protyay protyay added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 21, 2023
@github-actions github-actions bot added the @aws-cdk/aws-glue Related to AWS Glue label Jul 21, 2023
@protyay protyay changed the title (module name): (short issue description) aws-glue-alpha: Undefined behavior of Code.fromAsset API Jul 21, 2023
@peterwoodworth
Copy link
Contributor

This is working for me:

    new glue.Job(this, 'SparkScalaETLJob', {
      executable: glue.JobExecutable.scalaEtl({
        glueVersion: glue.GlueVersion.V3_0,
        script: glue.Code.fromAsset('assets/glue/index.js'),
        className: 'GlueApp',
      }),
      workerType: glue.WorkerType.G_1X,
      workerCount: 10,
      description: 'Glue ETL Job',
    });

Alternatively:

    const ASSET_PATH = path.join(__dirname, `../assets/glue/index.js`);

    new glue.Job(this, 'SparkScalaETLJob', {
      executable: glue.JobExecutable.scalaEtl({
        glueVersion: glue.GlueVersion.V3_0,
        script: glue.Code.fromAsset(ASSET_PATH),
        className: 'GlueApp',
      }),
      workerType: glue.WorkerType.G_1X,
      workerCount: 10,
      description: 'Glue ETL Job',
    });

It's possible you're running into a problem with the internal tooling, which we can't help with here. Ensure you're specifying the right path, else I assume this is an issue with the internal tooling.

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 21, 2023
@protyay
Copy link
Author

protyay commented Jul 22, 2023

Thanks. Found the issue. It was with a local folder.

@protyay protyay closed this as completed Jul 22, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-glue Related to AWS Glue bug This issue is a bug. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants