sintaxi / surge

CLI for the surge.sh CDN
https://surge.sh
2.86k stars 136 forks source link

Surge Teardown Not Working #282

Open febreroinfo opened 6 years ago

febreroinfo commented 6 years ago

I've mistakenly created a project with an invalid domain name. I'm trying to tear it down but was unsuccessful.

The domain name when I ran surge list

sl

The result when I ran surge teardown

st

Is there anyway I can tear down the project with the invalid name? I tried several times but was unsuccessful.

brandonb927 commented 6 years ago

@febreroinfo it looks like this is something @sintaxi will have to do in the backend

febreroinfo commented 6 years ago

Thanks @brandonb927. @sintaxi will you be able to assist regarding this matter? It would be greatly appreciated.

beenotung commented 6 years ago

I have the same issue, can the cli allow space in the input? \ or quoted by single/double quote

beenotung commented 6 years ago

in the latest version of surge list, I see an id beside the domain name, I tried to teardown the site using the id but it raise an error

surge teardown 1477261572142

assert.js:41
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: 'number' == 'string'
    at parse (/home/beenotung/.config/yarn/global/node_modules/url-parse-as-address/index.js:9:10)
    at Object.exports.validDomain (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/util/helpers.js:446:56)
    at module.exports (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/domainOrSilent.js:29:15)
    at next (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/util/skin.js:20:11)
    at exports.suggestDomainFromCname (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/discovery.js:20:10)
    at next (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/util/skin.js:20:11)
    at exports.setDomainFromArgs (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/discovery.js:45:10)
    at next (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/util/skin.js:20:11)
    at module.exports (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/shorthand.js:7:3)
    at next (/home/beenotung/.config/yarn/global/node_modules/surge/lib/middleware/util/skin.js:20:11)
Craaftx commented 5 years ago

Hello, I have the same problem on this date.

I launch a new surge command by following the video on the surge presentation and I inadvertently create a domain that can not be removed : image

image

I tried to use :

I hope this will help you

Craaftx commented 5 years ago

I think I found the problem, the Teardown command detects: rich-mass.surge.sh and new-oms-website.surge.sh as two parameters.

For the moment, it's bad, but I deleted the false domain by hard-coding the name in teardown.js on line 45: return remove(parseUrl(req.domain).host) to return remove("rich-mass.surge.sh new-oms-website.surge.sh")

I think to solve this error, we can:

👋

beenotung commented 5 years ago

I think it's better not to bad domain with space in the teardown command, as there exists such records. It may be better to allow deleting domain with space like surge teardown "a b c.surge"; allowing to delete by ID is also good

beenotung commented 5 years ago

@Craaftx thanks your suggestion, hard-coding works best for me in the one-time situation.

huwd commented 5 years ago

hey just thought I'd tie a few of these together also discussed: #230

jwilld commented 4 years ago

If you typed it in one line like "surge teardown domain.surge.sh", try typing "surge" first and a prompt for the domain name will show.

CharlesKumar commented 3 years ago

I also had this problem of weird domain registered in surge accidentally somehow

1539668485543 document.body.style.visibility = "hidden"; 2 years ago surge surge.sh Standard

Finally, @Craaftx 's solution of hard coding the url worked to remove the weird domain 'document.body.style.visibility = "hidden";'

I URL encoded and hard coded into the teardown.js

return remove("document.body.style.visibility%20%3D%20%22hidden%22%3B")

Now I got rid of that weird domain url and got the Success message for the removal of it. Note: surge teardown url (url doesn't matter as it is hardcoded as long as the function accepts it) Also I immediately reverted the code back to original (return remove(parseUrl(req.domain).host) ) after successful teardown.

`surge teardown "document.body.style.visibility%20%3D%20%22hidden%22%3B"

Success - document.body.style.visibility%20%3D%20%22hidden%22%3B has been removed.`

I also vote for teardown by id:

surge teardown 1539668485543