When debugging the CLI, best thing to do is turn on debug logging. You can do this with by setting a $DEBUG environment variable to the value * before running the command that hangs.
Then, you can send us the log but PLEASE be very careful to remove your API token from the log - that is like your password and should never be shared in public!
Hey there! Could you please try the following and see if it helps?
# unlink the site from Netlify
netlify unlink
# relink the site to Netlify
netlify link
# link will give you options on how to find which Netlify site you're deploying
# try the deploy again
netlify deploy
For additional context, it looks like the CLI is failing to find a site ID (relevant source code), so what this does is reestablish a link to the site — which should (hopefully!) fix the deploys.
I might be misunderstanding something about how the Netlify CLI is supposed to work. The scenario I’m trying to exercise is where the web app is not in a repository like GitHub, but is just a set of local files. In that case is it still necessary to run “netlify link”?
I’m writing the book “Svelte and Sapper in Action” for Manning. I have a chapter on deployment options where I’m trying to describe the basics of deploying web apps to Netlify.
BTW, I’ve been enjoying watching “Learn with Jason” videos!
Hey there! The CLI doesn’t need to be connected to a Git repo, but it does need to be connected to a Netlify site. You can create that site using the CLI with netlify init or through the app.netlify.com UI and link it with netlify link.
Thanks for watching! And I’m looking forward to seeing the book!
I think one issue is that I was trying to manually deploy a site that actually was in GitHub.
I copied the directory for that site to a new directory and deleted the .git directory.
Then I entered “netlify init”, selected “Yes, create and deploy site manually”, selected my team, and entered a site name. That gave me the following output:
After this I see the site at Netlify App. I’m guessing that means I don’t need to run “netlify link”, right?
Then I entered “netlify deploy” with DEBUG set to “*” and got the following output that just loops forever.
I had to replace “http” with “{PROTOCOL}” so I could submit this reply without it saying I included too many links.
Waiting for deploy to go live… netlify:open-api fetch done +5s
netlify:open-api response contentType: application/json; charset=utf-8 +0ms
netlify:open-api parsing json +0ms
Waiting for deploy to go live… netlify:open-api path template: {PROTOCOL}://api.netlify.com/api/v1/sites/{site_id}/deploys/{deploy_id} +1s
netlify:open-api replacing {site_id} with {TOKEN} +0ms
netlify:open-api replacing {deploy_id} with {TOKEN} +0ms
netlify:open-api bodyType: json +0ms
netlify:open-api specialHeaders: {} +0ms
netlify:open-api method: GET +0ms
netlify:open-api Rate limit attempt 0 for {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
netlify:open-api requesting {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
Waiting for deploy to go live… netlify:open-api fetch done +3s
netlify:open-api response contentType: application/json; charset=utf-8 +0ms
netlify:open-api parsing json +0ms
Waiting for deploy to go live… netlify:open-api path template: {PROTOCOL}://api.netlify.com/api/v1/sites/{site_id}/deploys/{deploy_id} +1s
netlify:open-api replacing {site_id} with {TOKEN} +0ms
netlify:open-api replacing {deploy_id} with {TOKEN} +0ms
netlify:open-api bodyType: json +0ms
netlify:open-api specialHeaders: {} +0ms
netlify:open-api method: GET +1ms
netlify:open-api Rate limit attempt 0 for {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
netlify:open-api requesting {PROTOCOL}://api.netlify.com/api/v1/sites/{TOKEN}/deploys/{TOKEN} +0ms
That was it! But in my case I need “-d public” because that is where Svelte places the files to be deployed.
Thanks so much for helping me through this! You can close this now, though I’m thinking even without the “-d” it should have output some sort of error message instead of looping forever.
This is set in the shell environment. For example, if you just want to see it for one command, that can be done on the same line as the command itself.
For example, say the command you are testing is this:
netlify deploy --prod -d public
You can set that environment variable for just the one command by appending it like so:
DEBUG='*' netlify deploy --prod -d public
If there are other questions, please reply anytime.