netlify / netlify/cli

Using `--alias` with invalid characters "slugifies" the string in the shell but sends the characters unchanged to `Deploy.subdomain_alias`.

Open
#969 5 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: command: deploy never_stale type: bug
Dominant language
TypeScript
Stars
1.9k
Forks
474
Avg merge
23h 30m
Merged PRs (30d)
53

Description

- Do you want to request a feature or report a bug?

A bug.

- What is the current behavior?

When using --alias to create a custom subdomain for a deploy, characters which would be invalid for a domain name are "slugified" in the shell URL but the database is still getting the unmodified string.

- If the current behavior is a bug, please provide the steps to reproduce.

Here is an example deploy:

$ netlify deploy --alias="not/working"
Deploy path:        /Users/me/data/git/overlordofmu/netlify-cli-manual-deploys/public
Configuration path: /Users/me/data/git/overlordofmu/netlify-cli-manual-deploys/netlify.toml
Deploying to draft URL...
✔ Finished hashing 8 files
✔ CDN requesting 0 files
✔ Finished uploading 0 assets
✔ Deploy is live!

Logs:              https://app.netlify.com/sites/netlify-cli-manual-deploys/deploys/5efaea211010bad6650a7350
Website Draft URL: https://not-working--netlify-cli-manual-deploys.netlify.app

If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag.
netlify deploy --prod

However, if I check the actual content of Deploy.subdomain_alias it is "not/working" instead of not-working. The URL in the deploy above does not work: https://not-working--netlify-cli-manual-deploys.netlify.app

- What is the expected behavior?

That the same "slugified" string shown in the shell command output be used for the subdomain_alias value and the given URL in the shell will then work.

- Local Environment Information

$ netlify version --verbose
────────────────────┐
 Environment Info   │
────────────────────┘

  System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: 77.0.1
    Safari: 13.1.1
  npmGlobalPackages:
    netlify-cli: 2.54.0

netlify-cli/2.54.0 darwin-x64 node-v12.18.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the netlify deploy --alias entry point and trace how the alias is transformed for the draft URL versus how it is sent to Deploy.subdomain_alias. Reproduce the not/working example, then verify that the stored alias and generated URL use the same slugified value.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.