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] Upgrading core pdk code results in reverting back to the original versions. #784

Closed
raurir opened this issue May 21, 2024 · 6 comments · Fixed by #795
Closed

[BUG] Upgrading core pdk code results in reverting back to the original versions. #784

raurir opened this issue May 21, 2024 · 6 comments · Fixed by #795
Labels
bug Something isn't working needs-triage stale

Comments

@raurir
Copy link

raurir commented May 21, 2024

Describe the bug

Attempting to upgrade pdk, pdk dependencies and projen roles back to previous versions.

Expected Behavior

aws/pdk should be upgraded to latest and projen should be upgraded to latest.

Current Behavior

Relevant bits of the upgrade logs included from reproduction steps below.

  1. @aws/pdk goes from 0.23.35 to 0.23.38 then back to 0.23.35
> @demo/monorepo@0.0.0 upgrade UpgradeDemo
> pnpm exec projen upgrade

👾 upgrade | pnpm dlx npm-check-updates@16 --upgrade --target=minor --peer --dep=dev,peer,prod,optional --filter=eslint-config-prettier,eslint-import-resolver-typescript,eslint-plugin-import,eslint-plugin-prettier,npm-check-updates,prettier,ts-node,typescript,@aws-cdk/aws-cognito-identitypool-alpha,aws-cdk-lib,cdk-nag
Progress: removed
Using pnpm
Upgrading UpgradeDemo/package.json
[====================] 11/11 100%
[====================] 3/3 100%

 aws-cdk-lib         2.137.0  →   2.142.1
 cdk-nag             2.28.92  →  2.28.119
 npm-check-updates  16.14.18  →  16.14.20

Run pnpm install to install new versions.
👾 upgrade | pnpm i --no-frozen-lockfile
Scope: all 3 workspace projects
Progress: removed

dependencies:
- aws-cdk-lib 2.137.0
+ aws-cdk-lib 2.142.1
- cdk-nag 2.28.92
+ cdk-nag 2.28.119

devDependencies:
- npm-check-updates 16.14.18
+ npm-check-updates 16.14.20

Done in 4.7s
👾 upgrade | pnpm update @aws/pdk @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser constructs eslint-config-prettier eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-prettier eslint npm-check-updates nx prettier projen syncpack ts-node typescript @aws-cdk/aws-cognito-identitypool-alpha aws-cdk-lib cdk-nag
Progress: removed

dependencies:
- @aws-cdk/aws-cognito-identitypool-alpha 2.134.0-alpha.0
+ @aws-cdk/aws-cognito-identitypool-alpha 2.142.1-alpha.0

devDependencies:
- @aws/pdk 0.23.35
+ @aws/pdk 0.23.38
- @types/node 18.19.26
+ @types/node 18.19.33 (20.12.12 is available)
- syncpack 12.3.0
+ syncpack 12.3.2

Done in 2.2s
👾 upgrade | pnpm exec projen
👾 default | ts-node --project tsconfig.dev.json .projenrc.ts
👾 Installing dependencies...
👾 install | pnpm i --no-frozen-lockfile
Scope: all 3 workspace projects
Progress: removed

devDependencies:
- @aws/pdk 0.23.38
+ @aws/pdk 0.23.35 (0.23.38 is available)

Done in 4.4s
  1. projen goes from 0.79.24 to 0.81.15 back to 0.79.27
> @demo/monorepo@0.0.0 upgrade-deps UpgradeDemo
> pnpm exec projen upgrade-deps

👾 upgrade-deps | pnpm exec nx run-many --target=upgrade --output-style=stream --nx-bail --projects=@demo/api,@demo/api-model

 >  NX   The following projects do not have a configuration for any of the provided targets ("upgrade")

   - @demo/api
   - @demo/api-model

 >  NX   No projects with target upgrade for 0 projects were run

 >  NX   Successfully ran target upgrade for 0 projects


👾 upgrade-deps | pnpm exec npm-check-updates --deep --rejectVersion 0.0.0 -u --dep prod,dev,peer,optional,bundle --target=minor
Using pnpm
Upgrading UpgradeDemo/package.json
[====================] 20/20 100%

 constructs   ^10.0.0  →   ^10.3.0
 projen      ^0.79.24  →  ^0.81.15
Upgrading UpgradeDemo/packages/api/generated/infrastructure/typescript/package.json
[====================] 8/8 100%

 @aws/pdk     ^0.23.35  →   ^0.23.38
 aws-cdk-lib  ^2.137.0  →   ^2.142.1
 cdk-nag      ^2.28.92  →  ^2.28.119
 projen       ^0.79.24  →   ^0.81.15
Upgrading UpgradeDemo/packages/api/generated/runtime/typescript/package.json
[====================] 8/8 100%

 constructs   ^10.0.0  →   ^10.3.0
 projen      ^0.79.24  →  ^0.81.15

Run pnpm install to install new versions.
👾 upgrade-deps | pnpm exec syncpack fix-mismatches
= Default Version Group ========================================================
    18 ✓ already valid
    30 ✓ fixed
✓ package.json
✓ packages/api/generated/infrastructure/typescript/package.json
✓ packages/api/generated/runtime/typescript/package.json
👾 upgrade-deps | rm pnpm-lock.yaml
👾 upgrade-deps | pnpm i
Scope: all 3 workspace projects
 WARN  5 deprecated subdependencies found: @npmcli/move-file@2.0.1, are-we-there-yet@3.0.1, gauge@4.0.4, npmlog@6.0.2, read-package-json@6.0.4
Packages: +4 -25
++++-------------------------
Progress: resolved 637, reused 629, downloaded 0, added 0, done

devDependencies:
- @aws/pdk 0.23.35
+ @aws/pdk 0.23.38
- projen 0.79.27
+ projen 0.81.15

 WARN  Issues with peer dependencies found
.
└─┬ @aws/pdk 0.23.38
  └── ✕ unmet peer projen@^0.79.24: found 0.81.15

packages/api/generated/infrastructure/typescript
└─┬ @aws/pdk 0.23.38
  └── ✕ unmet peer projen@^0.79.24: found 0.81.15

Done in 6s
👾 upgrade-deps | pnpm exec projen
👾 default | ts-node --project tsconfig.dev.json .projenrc.ts
👾 Installing dependencies...
👾 install | pnpm i --no-frozen-lockfile
Scope: all 3 workspace projects
 WARN  5 deprecated subdependencies found: @npmcli/move-file@2.0.1, are-we-there-yet@3.0.1, gauge@4.0.4, npmlog@6.0.2, read-package-json@6.0.4
Packages: +3 -2
+++--
Progress: resolved 637, reused 629, downloaded 0, added 0, done

devDependencies:
- projen 0.81.15
+ projen 0.79.27 (0.81.15 is available)

Done in 3.7s
  1. Re-synthing projen seems irrelevant, dependencies are not updated.

Reproduction Steps

Using these versions: @aws/pdk 0.23.35 & projen 0.79.24

Running the following steps does not upgrade pdk/projen:

  1. pnpm run upgrade
  2. pnpm upgrade-deps
  3. pnpm default

Possible Solution

No response

Additional Information/Context

A demo repo has been setup, hopefully it behaves the same in other environments:

https://github.com/raurir/projen-pdk-upgrade-issue/

PDK version used

0.23.35

What languages are you seeing this issue on?

Typescript

Environment details (OS name and version, etc.)

Macos 14.4

@raurir
Copy link
Author

raurir commented May 22, 2024

@agdimech Are you having the same issue in #710 ?

@carter293
Copy link

I've also had this issue and can't find a solution...

@agdimech
Copy link
Contributor

Hi - sorry for the delayed response.

The reason this is happening is because we actual pin the projen version as per:

import PROJEN_VERSION from "./projen-version";

So what is happening is the following:

1.) npm-check-updates runs and bumps everything to the latest version (projen is 0.82.6 as of today)
2.) syncpack ensures all subprojects use this version
3.) a synthesis occurs which picks up the default projen version which is currently pinned to ^0.79.24

To resolve this, you will need to do pin the projen version within your .projenrc as follows:

Option A: Pinned Version

const monorepo = new MonorepoTsProject({
  name: "@demo/monorepo",
  defaultReleaseBranch: "main",
  packageManager: NodePackageManager.PNPM,
  projenVersion: "^0.82.6",
  tsconfig: {
    compilerOptions: {
      lib: ["es2019", "dom"],
      skipLibCheck: true,
    },
  },
});

Option B: Latest Resolved Version

Note: this will result in the projen version being bumped each time you run a synth.

const monorepo = new MonorepoTsProject({
  name: "@demo/monorepo",
  defaultReleaseBranch: "main",
  packageManager: NodePackageManager.PNPM,
  projenVersion: "*",
  tsconfig: {
    compilerOptions: {
      lib: ["es2019", "dom"],
      skipLibCheck: true,
    },
  },
});

Let me know if this resolves your issue and again apologies for the delay (I was on vacation and then quite sick :( )

@raurir
Copy link
Author

raurir commented Jun 12, 2024

@agdimech Thank you!

Very Close... the dependencies updated, and almost everything builds.

Unfortunately the latest CloudscapeReactTsWebsiteProject is causing this error when building the website:

Attempted import error: 'getLogicalBoundingClientRect' is not exported from '@cloudscape-design/component-toolkit/internal' (imported as 'getLogicalBoundingClientRect').

I have logged a bug here which hopefully resolves it: cloudscape-design/component-toolkit#66

In my demo repo I did not add a CloudscapeReactTsWebsiteProject to keep things simple :(

Copy link

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot added the stale label Aug 19, 2024
Copy link

github-actions bot commented Sep 2, 2024

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants