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

[BUG] type-safe-api build fails when AWS_PDK_VERSION is not set in the environment #817

Open
memorsolutions opened this issue Jul 26, 2024 · 1 comment
Labels
backlog bug Something isn't working needs-triage

Comments

@memorsolutions
Copy link

Describe the bug

running pnpm build from the monorep root fails inside type-safe-api with multiple errors ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Cannot read properties of undefined

I first ran into the issue while attempting to develop a new feature within the baseline type-safe-api. Upon changing a source file (even as simple as adding an empty // comment to the end of a line, running pnpm build at the top level fails. This indeed happens any time there is a cache miss for the tpe-safe-api nx cloud cache. This can be observed in a fresh git (no changes) and running pnpm build --skip-nx-cache.

After some exploration, it seems that when working on a local machine, unless AWS_PDK_VERSION is explicitly set in the environment, the build will fail.

Expected Behavior

I expect a build to work out of the box.

Current Behavior

Without AWS_PDK_VERSION set, pnpm build eventually encounters multiple failures within type-safe-api in the general form of:

@aws/type-safe-api: running command pnpm exec ts-node pre-process-spec.ts --specPath=/tmp/tmp.X4i3yn/infra/../spec.yaml --outputSpecPath=/tmp/generate-client-python-async-cdk-infrastructure.9AanYF04M/.preprocessed-api.json --extraVendorExtensions={"x-runtime-module-name":"test_client","x-relative-spec-path":"../../spec.yaml","x-handlers-python-module":"","x-handlers-java-package":"","x-handlers-typescript-asset-path":"","x-handlers-python-asset-path":"","x-handlers-java-asset-path":"","x-handlers-node-lambda-runtime-version":"","x-handlers-python-lambda-runtime-version":"","x-handlers-java-lambda-runtime-version":""}
@aws/type-safe-api: undefined
@aws/type-safe-api:  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Cannot read properties of undefined (reading '/tmp/generate-client-python-async-cdk-infrastructure.9AanYF04M')

Reproduction Steps

Build fails:

git clone git clone https://github.com/aws/aws-pdk.git
cd aws-pdk
pnpm i
pnpm build --skip-nx-cache

Build succeeds:

git clone git clone https://github.com/aws/aws-pdk.git
cd aws-pdk
pnpm i
AWS_PDK_VERSION=0.23.47 pnpm build --skip-nx-cache

Possible Solution

It's unclear if this is an issue with packages/type-safe-api/scripts/type-safe-api/common/common.sh, or if it is the documentation in docs/content/contributing/index.md that lacks clear instructions on the correct way to build when contributing to the type-safe-api package.

Additional Information/Context

No response

PDK version used

0.23.46, 0.23.47

What languages are you seeing this issue on?

No response

Environment details (OS name and version, etc.)

Ubuntu 22.04

@memorsolutions memorsolutions added bug Something isn't working needs-triage labels Jul 26, 2024
@cogwirrel
Copy link
Member

Hi John,

Sorry for the slow reply - just back from leave!

Interesting, I'm not able to reproduce this!

I cleaned my ~/.pdk directory before cloning and building the repo - AWS_PDK_VERSION being unset means it creates a directory named ~/.pdk/type-safe-api rather than the usual ~/.pdk/$AWS_PDK_VERSION/type-safe-api etc, but the build still succeeds. My first guess was could it be the double / when it tries to mkdir ~/.pdk//type-safe-api, but it seems like it's pretty standard for posix to treat multiple slashes as a single one.

I wonder if you've had a chance to look into this any further?

Cheers,
Jack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants