Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Conversation

@dmvt
Copy link

@dmvt dmvt commented Sep 26, 2025

Problem

The deploy command was crashing with "Cannot read properties of undefined (reading 'map')" when no environment file was provided, preventing users from deploying CVMs.

Root Cause

The validateEnvFile() function returns undefined when no environment file is provided, but deployNewCvm() unconditionally called envs.map() without null checking.

Solution

  • Added null check: envs ? envs.map((env) => env.key) : []
  • Added defensive handling for data structure variations in nodes and KMS processing
  • Added null checks for target.images to prevent similar undefined access issues

Testing

  • ✅ Verified fix resolves the crash
  • ✅ Confirmed deploy command now works correctly
  • ✅ Tested with both environment files and without
  • ✅ Successfully deployed CVM to validate end-to-end functionality

Impact

This fix restores the core functionality of the deploy command, allowing users to deploy TEE applications without crashes when no environment file is specified.

…ploy command

- Fixed crash when envs is undefined by adding null check: envs ? envs.map(...) : []
- Added defensive handling for nodes and kms_list data structure variations
- Added null checks for target.images to prevent similar undefined access issues
- Resolves deployment failures caused by missing environment file parameter

The deploy command now properly handles cases where no environment file is provided,
allowing deployments to proceed correctly instead of crashing with undefined errors.
const nodes = nodes_result.data as any;
const nodesData = nodes_result.data as any;
// Handle both possible data structures
const nodes = nodesData.nodes || nodesData;
Copy link
Collaborator

Choose a reason for hiding this comment

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

that's not a safe operation.

const kms_list = kms_result.data as any;
const kmsData = kms_result.data as any;
// Handle both possible data structures
const kms_list = kmsData.items || kmsData;
Copy link
Collaborator

Choose a reason for hiding this comment

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

that's not a safe operation.

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.

2 participants