Skip to content

Treat positional file arguments as deploy roots, not config files #107

Description

@avocet-bot

Bug Description

A support ticket reported that deploying a local TypeScript entrypoint directly makes the CLI try to deserialize the TypeScript file as a Deno config file:

deno deploy --token "<TOKEN>" --org <ORG_NAME> --app <APP_NAME> --prod main.ts

Observed error:

✗ An error occurred: Failed deserializing config file 'file:///path/to/main.ts'.: Unexpected word on line 1 column 1

This still looks current on main (60a0c2f). The default deploy action passes the positional [root-path] into actionHandler(..., (rootPath) => rootPath), and readConfig() calls resolve_config(resolve(maybeConfigPath || rootPath), ...). In rs_lib/src/lib.rs, resolve_config() treats any file path as WorkspaceDiscoverStart::ConfigFile(&root_path):

let is_config_file = real_sys.fs_is_file(&root_path).unwrap_or(false);
let discover_start = if is_config_file {
  WorkspaceDiscoverStart::ConfigFile(&root_path)
} else {
  WorkspaceDiscoverStart::Paths(&dir_paths)
};

That behavior is right for an explicit --config deno-staging.json, but it is wrong for a positional deploy root/entrypoint like main.ts.

Expected Behavior

A positional file argument should be treated as the deploy target/root (or at least use its parent directory for config discovery), not as the config file to parse. Only an explicit --config <file> should force WorkspaceDiscoverStart::ConfigFile.

Suggested Fix

Split config discovery inputs:

  • --config <file>: keep current ConfigFile behavior so non-standard config filenames work.
  • positional [root-path] that is a file: discover config from the parent/workspace, and include/deploy the requested file instead of parsing it as JSONC.

A regression test should cover deno deploy --org o --app a --prod main.ts with main.ts containing TypeScript source.

Source

Raised in Deno Deploy support ticket TICKET-20260513-53582.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions