Bug: v0.2.8 npm package missing environment selection for app create — stale dist published
Description
The app create command in the published npm package @dokploy/cli@0.2.8 does not include the environment selection logic, even though the source code on main does (commit 68786fb). This causes a 400 Bad Request error when creating an application, because environmentId is never sent in the API payload.
The Dokploy server API (application.create) requires environmentId as a mandatory field, but the published CLI binary never prompts for it and never sends it.
Root Cause
The dist/ folder that was published to npm was built before the environment selection commits were added. The version was bumped to 0.2.8 in the same batch of commits (2647a59), but the compiled JS in the published tarball does not reflect the source changes.
Evidence — published dist/commands/app/create.js in npm package:
- ❌ No
environmentId flag defined
- ❌ No environment selection prompt
- ❌ API payload only sends
{ name, appDescription, appName, projectId } — missing environmentId
Source on main (src/commands/app/create.ts):
- ✅ Has
environmentId flag (line 25-29)
- ✅ Has environment selection prompt (lines 82-100)
- ✅ API payload includes
environmentId (line 162)
Steps to Reproduce
- Install the CLI:
npm install -g @dokploy/cli@0.2.8
- Authenticate:
dokploy authenticate
- Run:
dokploy app create
- Select a project, enter app name, confirm creation
- Result:
Error: Error creating application: Request failed with status code 400
The server responds with:
{
"message": "Input validation failed",
"code": "BAD_REQUEST",
"data": {
"zodError": {
"fieldErrors": {
"environmentId": ["Invalid input: expected string, received undefined"]
}
}
}
}
Expected Behavior
- The CLI should prompt the user to select an environment (if the project has multiple environments) or auto-select if there's only one
- The
environmentId should be included in the API request payload
- Application should be created successfully
Suggested Fix
- Rebuild and republish — run the build step before publishing to npm so the dist matches the source on
main
- (Optional improvement) Auto-select the environment when a project has only one, and only prompt when there are multiple:
if (!environmentId) {
if (!selectedProject?.environments || selectedProject.environments.length === 0) {
this.error(chalk.yellow("No environments found in this project."));
}
if (selectedProject.environments.length === 1) {
environmentId = selectedProject.environments[0].environmentId;
this.log(chalk.dim(` Auto-selected environment: ${selectedProject.environments[0].name}`));
} else {
const { environment } = await inquirer.prompt([
{
choices: selectedProject.environments.map((env) => ({
name: `${env.name}${env.description ? ` (${env.description})` : ''}`,
value: env,
})),
message: "Select an environment:",
name: "environment",
type: "list",
},
]);
environmentId = environment.environmentId;
}
}
Environment
- CLI version: @dokploy/cli v0.2.8 (npm)
- OS: Linux / macOS
- Node: v18+
- Dokploy server: Latest
Areas Affected
app create command (interactive mode)
- npm publish pipeline
Bug: v0.2.8 npm package missing environment selection for
app create— stale dist publishedDescription
The
app createcommand in the published npm package@dokploy/cli@0.2.8does not include the environment selection logic, even though the source code onmaindoes (commit68786fb). This causes a400 Bad Requesterror when creating an application, becauseenvironmentIdis never sent in the API payload.The Dokploy server API (
application.create) requiresenvironmentIdas a mandatory field, but the published CLI binary never prompts for it and never sends it.Root Cause
The
dist/folder that was published to npm was built before the environment selection commits were added. The version was bumped to0.2.8in the same batch of commits (2647a59), but the compiled JS in the published tarball does not reflect the source changes.Evidence — published
dist/commands/app/create.jsin npm package:environmentIdflag defined{ name, appDescription, appName, projectId }— missingenvironmentIdSource on
main(src/commands/app/create.ts):environmentIdflag (line 25-29)environmentId(line 162)Steps to Reproduce
npm install -g @dokploy/cli@0.2.8dokploy authenticatedokploy app createError: Error creating application: Request failed with status code 400The server responds with:
{ "message": "Input validation failed", "code": "BAD_REQUEST", "data": { "zodError": { "fieldErrors": { "environmentId": ["Invalid input: expected string, received undefined"] } } } }Expected Behavior
environmentIdshould be included in the API request payloadSuggested Fix
mainEnvironment
Areas Affected
app createcommand (interactive mode)