Skip to content

Invalid Domain Names Bypass Validation, Waste Build Time #3151

@RayyanSeliya

Description

@RayyanSeliya

Problem

When running func deploy with invalid domain names, the command attempts to build before catching domain format errors, resulting in wasted time and confusing error messages.

Current Behavior

Invalid domain with spaces

Command:

func deploy --registry ghcr.io/user --domain "my app.com"

Current Output:

Building function image
Still building
^CError: executing lifecycle: context canceled

Problems:

  • Starts building before validating domain format
  • Wastes time (minutes) building
  • Generic build error, no indication domain naming is the issue

Domain with uppercase letters

Command:

func deploy --registry ghcr.io/user --domain "Example.Com"

Current Output:

Building function image
Still building
^CError: executing lifecycle: context canceled

Problems:

  • Proceeds to build with invalid domain format
  • No guidance on valid domain naming rules

Domain with special characters

Command:

func deploy --registry ghcr.io/user --domain "[email protected]"

Current Output:

Building function image
Still building
^CError: executing lifecycle: context canceled

Problems:

  • No early validation for domain format
  • User must manually cancel build

Proposed Improvement

Command:

func deploy --registry ghcr.io/user --domain "my app.com"

Improved Output:

Error: invalid domain

Domain names must be valid DNS subdomains:
  - Lowercase letters, numbers, hyphens (-), and dots (.) only
  - Start and end with a letter or number
  - Max 253 characters total, each part between dots max 63 characters

Valid examples:
  func deploy --registry ghcr.io/user --domain example.com
  func deploy --registry ghcr.io/user --domain api.example.com

Note: Domain must be configured on your Knative cluster, or it will be ignored.

For more options, run 'func deploy --help'

Benefits

  • Catches domain errors before build starts
  • Clear, actionable error messages
  • Consistent with namespace, image validation
  • Saves time (no wasted builds)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions