netlify / cli

Netlify Command Line Interface
http://cli.netlify.com
MIT License
1.58k stars 352 forks source link

"Warning: undefined.netlify.app already exists..." warning when entering site name for `sites:create-template` #6894

Open benhancock opened 1 week ago

benhancock commented 1 week ago

Describe the bug

When I run netlify sites:create-template, authorize with GitHub PAT, and select any template, I cannot proceed past the ? Site name (leave blank for a random name; you can change it later): prompt because any input results in a › Warning: undefined.netlify.app already exists or a repository named undefined already exists on this account. Please try a different slug. message. This appears to actually result in a new site being created whenever leaving blank for a random name, but never for any non-empty name input

Steps to reproduce

  1. Run netlify sites:create-template
  2. Authorize with GitHub Personal Access Token
  3. Select any template
  4. Try to enter any site name
  5. Try to leave site name blank for random name
Screenshot 2024-10-22 at 3 50 19 PM
  1. Note that when you run sites:list afterward, a new site is created for every time you enter a newline for a random name, but no sites are created when you type in a name (whether it is actually a duplicate or not)

Configuration

No response

Environment

System: OS: macOS 15.0 CPU: (8) arm64 Apple M2 Memory: 94.78 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node Yarn: 1.22.21 - ~/.nvm/versions/node/v21.6.2/bin/yarn npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm pnpm: 9.12.0 - ~/.nvm/versions/node/v21.6.2/bin/pnpm npmGlobalPackages: netlify-cli: 17.36.4

benhancock commented 16 hours ago

This issue ended up being because my PAT did not grant permissions to create the repo. A more specific error message would be helpful here.

There are a couple other issues I encounter when running the command, though:

  1. I can only use the "leave blank for random name" option once per template. If I try it again with the same template, I am prompted for a new name
  2. Every time I enter a name that does not match a repo on my github account but does match an existing Netlify site (mine or someone else's) and am re-prompted for a name, I end up with an additional unused repo in my GitHub account. So if I enter 5 different taken names in a row, I end up with 5 unused empty repositories in my GitHub account.