Skip to content

fix(security): bulk dependency updates to resolve Dependabot alerts - #325

Merged
ulises-jeremias merged 2 commits into
mainfrom
fix/dependabot-security-updates
Jul 27, 2026
Merged

fix(security): bulk dependency updates to resolve Dependabot alerts#325
ulises-jeremias merged 2 commits into
mainfrom
fix/dependabot-security-updates

Conversation

@ulises-jeremias

@ulises-jeremias ulises-jeremias commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

Mass security update across all example projects to address the 681 open Dependabot security alerts.

  • Ran npm audit fix --legacy-peer-deps in all npm-based examples (20 projects)
  • Ran pnpm update --latest in pnpm-based examples (2 projects)
  • Ran yarn upgrade in the yarn-based example
  • Updated Python requirements.txt files for critical/high severity issues
  • Removed auto-generated klotho-analysis/_compiled/ directory and added .gitignore entry

Refs #326, #327, #328, #329, #330, #331, #332, #333, #334, #335

Python package updates (direct dependency fixes)

File Package From To Severity
serverless-python-fastapi/requirements.txt h11 0.14.0 0.16.0 Critical
serverless-python-fastapi/requirements.txt idna 3.7 3.15 Medium
serverless-appsync-python/requirements.txt python-dotenv 0.20.0 1.2.2 Medium
serverless-appsync-python/requirements.txt pytest 7.1.2 9.0.3 Medium
serverless-glue-deployment/requirements.txt pytest 7.1.2 9.0.3 Medium

Remaining alerts

Some vulnerabilities could not be auto-fixed because they require breaking changes to the Serverless framework (v3→v4 major bump). These are tracked in #326.

Additionally, 24 alerts in examples/klotho-analysis/klotho-go-example/_compiled/ were in auto-generated/compiled code — that directory has been removed in this PR.

Test plan

  • CI passes on this PR (shellcheck, markdownlint, tf-check)
  • Dependabot re-scans and closes resolved alerts after merge

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Examples

    • Refreshed sample project configurations and generated outputs.
    • Removed obsolete compiled deployment artifacts from the Go example.
    • Updated several example projects for improved compatibility with current tooling.
    • Added workspace build configuration for the LocalStack example.
  • Maintenance

    • Refined ignore rules to keep generated infrastructure output out of source control.
    • Updated testing and runtime support settings across Python and Node.js examples.

@ulises-jeremias
ulises-jeremias requested a review from edamico as a code owner July 27, 2026 14:34
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Warnings
⚠️ This PR is changing more than 200 lines.
⚠️ This PR is changing more than 10 files.
Messages
📖

📋 Missing Summary - Can you add a Summary? To do so, add a ## Description section to your PR description. This is a good place to explain the motivation for making this change.

📖 Thanks! We ❤️ removing more lines than added!

Generated by 🚫 dangerJS against 02deaeb

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change ignores and removes generated Klotho compiled output, including infrastructure and application artifacts. It also updates Node.js and Python dependency versions across several examples and adds pnpm build configuration.

Changes

Klotho compiled output cleanup

Layer / File(s) Summary
Ignore and remove generated output
examples/klotho-analysis/klotho-go-example/.gitignore, examples/klotho-analysis/klotho-go-example/_compiled/...
The example ignores _compiled/, while generated MemoryDB provisioning and Go Lambda application code are removed along with the broader compiled output.

Example dependency updates

Layer / File(s) Summary
Update Node.js example dependencies
examples/node-package-managers/examples/pnpm-project/package.json, examples/serverless-localstack-with-s3-and-dynamodb/package.json, examples/serverless-localstack-with-s3-and-dynamodb/pnpm-workspace.yaml
Node.js dependencies are upgraded, and the LocalStack workspace adds allowBuilds settings.
Update Python example dependencies
examples/serverless-appsync-python/requirements.txt, examples/serverless-glue-deployment/requirements.txt, examples/serverless-python-fastapi/requirements.txt
Pinned Python package versions are updated across three examples.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: edamico

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: bulk dependency updates to address Dependabot alerts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dependabot-security-updates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

ulises-jeremias and others added 2 commits July 27, 2026 12:26
Addresses 681 open Dependabot security alerts by updating lock files
across all example projects using `npm audit fix --legacy-peer-deps`,
`pnpm update --latest`, and `yarn upgrade`. Also updates Python
requirements.txt files for critical/high severity vulnerabilities:

- h11: 0.14.0 → 0.16.0 (critical, HTTP request smuggling)
- idna: 3.7 → 3.15 (medium, DoS)
- python-dotenv: 0.20.0 → 1.2.2 (medium)
- pytest: 7.1.2 → 9.0.3 (medium)

Note: some vulnerabilities remain where they require breaking changes
to the serverless framework major version (v3→v4). These require
manual intervention or separate PRs per project.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The _compiled/ output was generated by Klotho (a now-discontinued tool)
and committed as a single snapshot. It has never been updated and carries
ongoing Dependabot alerts that cannot be maintained. Adds _compiled/ to
.gitignore so any local regeneration is not tracked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ulises-jeremias
ulises-jeremias force-pushed the fix/dependabot-security-updates branch from e5d4bc2 to 02deaeb Compare July 27, 2026 15:27
@ulises-jeremias
ulises-jeremias merged commit 0e4410c into main Jul 27, 2026
17 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/node-package-managers/examples/pnpm-project/package.json`:
- Around line 13-17: Update the pnpm example’s package configuration to address
the Express 5 runtime requirement: add an explicit Node 18+ target using the
package’s engines configuration or an equivalent repository-standard version
file, or remove the unused express dependency if no Express API is exercised.
Keep the remaining dependencies unchanged.

In `@examples/serverless-localstack-with-s3-and-dynamodb/package.json`:
- Around line 50-54: Update the dependencies in package.json so ts-jest remains
within its direct TypeScript compiler support: constrain the typescript
dependency to a supported 6.x version, unless this project is explicitly
configured with ts-jest’s documented TypeScript 7 side-by-side compatibility
setup. Preserve the existing type-check and npx tsc behavior.

In `@examples/serverless-localstack-with-s3-and-dynamodb/pnpm-workspace.yaml`:
- Around line 2-5: Update the build approvals in allowBuilds by replacing the
placeholder strings for aws-sdk, esbuild, serverless, and unrs-resolver with
boolean values; set serverless and esbuild to true, and aws-sdk and
unrs-resolver to false.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b5149b7-cbad-4405-9fe9-f8f92070b2cc

📥 Commits

Reviewing files that changed from the base of the PR and between 8b38867 and 02deaeb.

⛔ Files ignored due to path filters (24)
  • examples/aws-cloudwatch-evidently/poc/package-lock.json is excluded by !**/package-lock.json
  • examples/klotho-analysis/klotho-go-example/_compiled/my-first-app.png is excluded by !**/*.png
  • examples/kubernetes-tilt-dev/apps/node-nestjs-app/package-lock.json is excluded by !**/package-lock.json
  • examples/node-package-managers/examples/npm-project/package-lock.json is excluded by !**/package-lock.json
  • examples/node-package-managers/examples/pnpm-project/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/node-package-managers/examples/yarn-project/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • examples/serverless-appsync-node-typescript/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-appsync-python/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-cognito-local/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-glue-deployment/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-glue-full-boilerplate/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-localstack-with-s3-and-dynamodb/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • examples/serverless-neo4j-ec2/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-node-typescript-bundle/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-node-typescript-middy-custom-middleware/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-node-typescript-middy/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-node-typescript-nest/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-python-fastapi/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-s3-local/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-sqs-node-typescript-offline-with-elasticmq/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-sqs-python/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-start-stop-ec2-instance/package-lock.json is excluded by !**/package-lock.json
  • examples/serverless-twilio-aws-lambdas-typescript/package-lock.json is excluded by !**/package-lock.json
  • tools/danger/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (57)
  • examples/klotho-analysis/klotho-go-example/.gitignore
  • examples/klotho-analysis/klotho-go-example/_compiled/Pulumi.my-first-app.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/Pulumi.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/deploylib.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/analytics.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/api_gateway.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/cockroachdb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/eks.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/elasticache.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/alb_controller/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/alb_controller/target_group_binding.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/cloudmap_cluster_set.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/cloudmap_export_service.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/external_dns/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/metrics_server/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/helm_chart.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/horizontal-pod-autoscaling.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/kubernetes.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/load_balancing.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/memorydb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/app_runner.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/cloud_watch.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/common.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/dynamodb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/ec2.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/ecs.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/eks.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/elasticache.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/elb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/eventbridge.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/iam.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/lambda.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/memorydb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/rds.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/s3.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/secrets_manager.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/service_discovery.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/sns.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/sanitizer.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/klotho.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/main/Dockerfile
  • examples/klotho-analysis/klotho-go-example/_compiled/main/go.mod
  • examples/klotho-analysis/klotho-go-example/_compiled/main/main.go
  • examples/klotho-analysis/klotho-go-example/_compiled/my-first-app.json
  • examples/klotho-analysis/klotho-go-example/_compiled/package.json
  • examples/klotho-analysis/klotho-go-example/_compiled/resources.json
  • examples/klotho-analysis/klotho-go-example/_compiled/tsconfig.json
  • examples/node-package-managers/examples/pnpm-project/package.json
  • examples/serverless-appsync-python/requirements.txt
  • examples/serverless-glue-deployment/requirements.txt
  • examples/serverless-localstack-with-s3-and-dynamodb/package.json
  • examples/serverless-localstack-with-s3-and-dynamodb/pnpm-workspace.yaml
  • examples/serverless-python-fastapi/requirements.txt
💤 Files with no reviewable changes (50)
  • examples/klotho-analysis/klotho-go-example/_compiled/main/Dockerfile
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/cloudmap_export_service.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/iam.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/eventbridge.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/Pulumi.my-first-app.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/eks.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/cloudmap_cluster_set.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/klotho.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/package.json
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/alb_controller/target_group_binding.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/dynamodb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/Pulumi.yaml
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/secrets_manager.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/lambda.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/my-first-app.json
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/ecs.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/tsconfig.json
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/app_runner.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/resources.json
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/elasticache.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/metrics_server/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/ec2.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/cloud_watch.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/elasticache.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/common.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/service_discovery.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/elb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/horizontal-pod-autoscaling.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/external_dns/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/s3.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/helm_chart.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/rds.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/analytics.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/load_balancing.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/kubernetes.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/memorydb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/api_gateway.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/cloud_map_controller/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/k8s/add_ons/alb_controller/index.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/main/main.go
  • examples/klotho-analysis/klotho-go-example/_compiled/main/go.mod
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/aws/sns.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/memorydb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/eks.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/sanitization/sanitizer.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/iac/cockroachdb.ts
  • examples/klotho-analysis/klotho-go-example/_compiled/deploylib.ts

Comment on lines +13 to +17
"@chakra-ui/react": "^3.36.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"express": "^5.2.1",
"framer-motion": "^12.42.2"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

project='examples/node-package-managers/examples/pnpm-project'

fd -HI -a '^(package\.json|\.nvmrc|\.node-version)$' "$project" \
  -x sh -c 'echo "--- $1"; sed -n "1,180p" "$1"' sh {}

rg -n -C2 \
  -e "from ['\"]express['\"]" \
  -e "require\(['\"]express['\"]\)" \
  -e '\.del\(' \
  -e 'req\.param\(' \
  -e 'acceptsCharset\(' \
  -e 'acceptsEncoding\(' \
  -e 'acceptsLanguage\(' \
  "$project" || true

Repository: nanlabs/devops-reference

Length of output: 663


🏁 Script executed:

#!/bin/bash
set -euo pipefail

project='examples/node-package-managers/examples/pnpm-project'

echo "Tracked files in project:"
git ls-files "$project" | sed -n '1,120p'

echo
echo "Node version files anywhere (focused names):"
git ls-files | grep -E '(^|/)(package\.json|pnpm-workspace\.yaml|\.nvmrc|\.node-version)$' | while IFS= read -r f; do
  case "$f" in
    *pnpm-project/package.json|*pnpm-workspace.yaml)
      echo "--- $f"
      sed -n '1,180p' "$f"
      ;;
  esac
done

echo
echo "Express imports/usages in examples/node-package-managers/examples/pnpm-project:"
rg -n -C2 \
  -e "from ['\"]express['\"]" \
  -e "require\(['\"]express['\"]\)" \
  -e "app\.use\(" \
  -e "app\.\w+\(" \
  -e "\.use\(" \
  -e '\.del\(' \
  -e 'req\.param\(' \
  -e 'acceptsCharset\(' \
  -e 'acceptsEncoding\(' \
  -e 'acceptsLanguage\(' \
  "$project" || true

echo
echo "Lockfile snippet for pnpm-project if present:"
if [ -f "$project/pnpm-lock.yaml" ]; then
  sed -n '1,220p' "$project/pnpm-lock.yaml"
else
  echo "no pnpm-lock.yaml under $project"
fi

Repository: nanlabs/devops-reference

Length of output: 11183


Pin or justify the Node target for Express 5.

The example locks express@5.2.1, but package.json has no Node engine/.nvmrc and no source to exercise Express APIs. Add a Node 18+ target or remove Express 5 until it is exercised.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/node-package-managers/examples/pnpm-project/package.json` around
lines 13 - 17, Update the pnpm example’s package configuration to address the
Express 5 runtime requirement: add an explicit Node 18+ target using the
package’s engines configuration or an equivalent repository-standard version
file, or remove the unused express dependency if no Express API is exercised.
Keep the remaining dependencies unchanged.

Comment on lines +50 to +54
"ts-jest": "^29.4.12",
"ts-loader": "^9.6.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5"
"typescript": "^7.0.2"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

project='examples/serverless-localstack-with-s3-and-dynamodb'

fd -HI -a '^(jest\.config\..*|tsconfig.*\.json|package\.json)$' "$project" \
  -x sh -c 'echo "--- $1"; sed -n "1,220p" "$1"' sh {}

rg -n -C3 -e 'ts-jest' -e 'preset[[:space:]]*:' -e 'transform[[:space:]]*:' "$project" || true

Repository: nanlabs/devops-reference

Length of output: 7350


🌐 Web query:

ts-jest 29.4.12 TypeScript support 7 side-by-side setup

💡 Result:

In ts-jest version 29.4.12, TypeScript 7 is supported via a specific side-by-side configuration [1][2]. This setup is required because TypeScript 7 does not provide the specific JavaScript compiler API that ts-jest needs for features such as transforms, language-service diagnostics, source maps, and custom AST transformers [3]. To implement this side-by-side setup, you must install both TypeScript 7 and a compatible TypeScript 6 version (specifically @typescript/typescript6) to act as the compiler API provider for ts-jest [3]. Recommended Setup Process: 1. Install TypeScript 7 for your native compilation needs: npm install --save-dev typescript@7 2. Install the TypeScript 6 compatibility package to satisfy ts-jest requirements: npm install --save-dev typescript6@npm:typescript@6 3. Configure your project to use these versions: - Use the native npx tsc for your project's type-checking and builds [3]. - You may use an alias such as npx tsc6 when you specifically need to run the TypeScript 6 compatibility compiler [3]. - Ensure ts-jest continues to reference the version 6 API through the established alias, as it avoids unstable native API calls and preserves the existing transformer contract [3]. Important Considerations: - Do not set the ts-jest compiler option to @typescript/native or attempt to bypass peer dependency checks with --legacy-peer-deps, as this can lead to an unstable compiler integration [3]. - ts-jest will automatically locate the required TypeScript 6 API if it is available via the side-by-side alias, and it does not silently fall back to the TypeScript 6 package if it is missing [3]. - Projects not yet using TypeScript 7 can continue to install the standard typescript package normally [3].

Citations:


🌐 Web query:

ts-jest TypeScript 7 side-by-side setup @tsj/typescript6 ts-jest compiler

💡 Result:

TypeScript 7.0 removed the in-process JavaScript compiler API required by ts-jest [1]. To use ts-jest with a project using TypeScript 7, you must implement a side-by-side setup where both the native TypeScript 7 compiler (for building) and a compatible TypeScript 6 package (for ts-jest's transforms and diagnostics) coexist in your project [2][3]. Official Configuration for TypeScript 7 To maintain compatibility, you must install TypeScript 7 and the TypeScript 6 compatibility package using npm aliases. Do not install TypeScript 7 directly as the sole typescript dependency [2]. 1. Installation: Use npm aliases to install both versions [2][3]: npm install --save-dev typescript@npm:typescript@7.0.0 typescript-6@npm:typescript@6.0.0 2. Project Usage: - Run npx tsc to execute the native TypeScript 7 compiler for your project's type-checking and builds [2][3]. - ts-jest will automatically use the typescript package (the alias resolving to the compatibility version) to access the required JavaScript compiler API [2]. Critical Setup Rules - Do not set the ts-jest compiler option to @typescript/native or any other native TS 7 path. Doing so will cause ts-jest to fail because TypeScript 7 lacks the necessary API [2][3]. - Do not bypass peer dependency checks (e.g., --legacy-peer-deps) to install TS 7, as this will lead to runtime errors when ts-jest attempts to load missing compiler APIs [2][3]. - ts-jest does not support a dual-compiler path where diagnostics are handled by TS 7 and transforms by TS 6 simultaneously, as this would break the consistency between the compiler's Program contract and ts-jest's AST transformers [2][3]. Experimental Native Engine If you require native TS 7 type-checking while running tests, ts-jest has introduced an experimental feature. You can configure the diagnostics engine to delegate type-checking to the native compiler out-of-process while maintaining the standard ts-jest emit/transform pipeline [1]: // jest.config.ts export default { //... globals: { 'ts-jest': { diagnostics: { engine: 'native', }, }, }, }; When this engine is active, ts-jest avoids loading the LanguageService and uses the native compiler's synchronous stdio API for diagnostics [1].

Citations:


Keep the Jest transform in ts-jest’s direct compiler support.

ts-jest 29.4.12 supports TypeScript up to 6.x directly; TypeScript 7 requires the documented side-by-side setup, but this project still exposes typescript: ^7.0.2 as npx tsc/type-check and no TS 6 compatibility alias is configured. Constrain typescript to 6, or add the required TS 7 compatibility setup.

Proposed compatibility fix
-    "typescript": "^7.0.2"
+    "typescript": "^6.0.0"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"ts-jest": "^29.4.12",
"ts-loader": "^9.6.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.9.5"
"typescript": "^7.0.2"
"ts-jest": "^29.4.12",
"ts-loader": "^9.6.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^6.0.0"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/serverless-localstack-with-s3-and-dynamodb/package.json` around
lines 50 - 54, Update the dependencies in package.json so ts-jest remains within
its direct TypeScript compiler support: constrain the typescript dependency to a
supported 6.x version, unless this project is explicitly configured with
ts-jest’s documented TypeScript 7 side-by-side compatibility setup. Preserve the
existing type-check and npx tsc behavior.

Comment on lines +2 to +5
aws-sdk: set this to true or false
esbuild: set this to true or false
serverless: set this to true or false
unrs-resolver: set this to true or false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

project='examples/serverless-localstack-with-s3-and-dynamodb'

sed -n '1,80p' "$project/pnpm-workspace.yaml"
fd -HI -a '^(package\.json|pnpm-lock\.yaml)$' "$project" \
  -x sh -c 'echo "--- $1"; sed -n "1,120p" "$1"' sh {}

Repository: nanlabs/devops-reference

Length of output: 6130


🌐 Web query:

pnpm allowBuilds configuration true false placeholder string install fails

💡 Result:

The allowBuilds configuration in pnpm is a setting used to manage which dependencies are permitted to execute build scripts (such as postinstall) [1][2]. It replaces older, deprecated settings like onlyBuiltDependencies and neverBuiltDependencies [2][3]. The issue you are observing—where pnpm modifies your pnpm-workspace.yaml file to include a placeholder string like set this to true or false—is an intended (though sometimes disruptive) behavior of pnpm's security policy [4][5]. How it works: When pnpm encounters a dependency that requires a build script but is not explicitly listed in your allowBuilds configuration, it automatically updates pnpm-workspace.yaml [1][5]. It inserts the package name and assigns it the string placeholder set this to true or false to prompt you to make a security decision [4][5]. Why installations fail: 1. Invalid Value: The system expects a boolean (true or false) [6]. The string placeholder set this to true or false is not a valid boolean, which can cause pnpm to reject the configuration or fail during subsequent command execution [6]. 2. Strict Mode: By default, if a package with a build script is not listed as true in allowBuilds, and strictDepBuilds is enabled (which is the default), pnpm will block the installation and throw an error [1][2]. How to resolve it: To fix the installation failure, you must manually edit your pnpm-workspace.yaml file [1][5]. Replace the placeholder string with either true (to allow the build) or false (to deny it) [1][3]. Example: Change this: allowBuilds: esbuild: set this to true or false To this: allowBuilds: esbuild: true Alternatively, you can run pnpm approve-builds, which provides an interactive prompt to manage these settings automatically and correctly update your configuration file [7][5]. Note on related issues: There have been reported bugs where pnpm unnecessarily overwrites existing settings or writes these placeholders even in non-interactive environments (such as CI/CD pipelines) [4][8]. If you are experiencing this in an automated environment, ensure you are not triggering workflows that bypass the intended approval process, and be aware that some older versions or specific flag combinations (like --ignore-workspace) have been identified as contributors to this clobbering behavior [4][8].

Citations:


Replace the unresolved build-approval placeholders with booleans.

allowBuilds expects true or false per package, but this workspace currently contains the placeholder strings. With strict script-build checking enabled, these unresolved entries can block installs or prevent required build scripts from running. Set each entry explicitly—allow serverless and esbuild if trusted/reviewed, and leave the others as false.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/serverless-localstack-with-s3-and-dynamodb/pnpm-workspace.yaml`
around lines 2 - 5, Update the build approvals in allowBuilds by replacing the
placeholder strings for aws-sdk, esbuild, serverless, and unrs-resolver with
boolean values; set serverless and esbuild to true, and aws-sdk and
unrs-resolver to false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant