Skip to content

Comments

fix(engine): update z.record() to Zod v4 two-argument syntax#13298

Merged
czubocha merged 1 commit intomainfrom
sc-3788
Jan 27, 2026
Merged

fix(engine): update z.record() to Zod v4 two-argument syntax#13298
czubocha merged 1 commit intomainfrom
sc-3788

Conversation

@czubocha
Copy link
Contributor

@czubocha czubocha commented Jan 27, 2026

Fix z.record() Zod v4 migration in aws.js

Summary

  • Fix TypeError: Cannot read properties of undefined (reading '_zod') when deploying Fargate container services with [email protected] deployment type
  • Update z.record(JSONValue) to z.record(z.string(), JSONValue) to comply with Zod v4 API
  • Add unit tests for container schema environment variable validation

Related

Closes #13297

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced environment variable validation in container configurations with explicit string key type enforcement, ensuring more consistent and reliable schema validation.
  • Tests

    • Added comprehensive test coverage for environment variable handling in container configurations, including support for multiple data types, nested structures, and optional environment properties.

✏️ Tip: You can customize this high-level summary in your review settings.

@czubocha czubocha requested a review from eahefnawy January 27, 2026 20:08
@Mmarzex
Copy link
Contributor

Mmarzex commented Jan 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Updated ConfigContainerSchema.environment in packages/engine/src/types/aws.js to use z.record(z.string(), JSONValue). Added tests validating environment handling (primitive and nested values, optionality). Minor package.json change.

Changes

Cohort / File(s) Summary
Engine AWS schema
packages/engine/src/types/aws.js
Tightened schema: ConfigContainerSchema.environment changed from .record(JSONValue) to .record(z.string(), JSONValue).
Schema validation tests
packages/engine/test/schemaValidation.test.js
Added test suite for environment variables: validates primitives, nested structures, and absence of environment via safeParse using ConfigContainerSchema.
Manifest
package.json
One-line modification (+1/−1).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at schemas new,
Keys now stringed, with values true.
In burrows deep, the tests all pass,
Nested veggies in a JSON mass.
Thump-thump! I stamp with fluffy pride—
Deployments hop without a slide. 🥕🐇

🚥 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 PR title accurately describes the main change: updating z.record() calls to Zod v4's two-argument syntax in the aws.js file to fix the TypeError.
Linked Issues check ✅ Passed The PR addresses the core requirement from issue #13297 by updating z.record(JSONValue) to z.record(z.string(), JSONValue) to comply with Zod v4 API and resolve the TypeError.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the reported Zod v4 compatibility issue: the schema update in aws.js and corresponding test coverage are both necessary and on-topic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

@czubocha czubocha merged commit e215a4d into main Jan 27, 2026
13 checks passed
@czubocha czubocha deleted the sc-3788 branch January 27, 2026 20:37
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TypeError: Cannot read properties of undefined (reading '_zod') when deploying containers (v4.31.1)

3 participants