function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Parteek Goyal 3Parteek Goyal 3 

SFDX: Authorize an Org failed to run

Hi All,

I am tring to authorize an org on visual studio code but when I am trying authorize it, I am getting the below error.

SFDX: Authorize an Org failed to run
Try this:
Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.
19:31:13.241 sfdx force:auth:web:login --setalias VSCodePlayground --instanceurl https://login.salesforce.com --setdefaultusername ended with exit code 1

I have Killed the Process on port 1717 and tried it again then I am not getting any error but it is running for infinite time. 

Please help.

Thanks,
Parteek
Khan AnasKhan Anas (Salesforce Developers) 
Hi Parteek,

Greetings to you!

Please refer to the below links which might help you further with the above issue.

https://salesforce.stackexchange.com/questions/208158/authorizing-dev-hub-from-force-com-ide2-redirects-to-localhost-after-authorizing

https://salesforce.stackexchange.com/questions/249857/cannot-connect-a-salesforce-org-using-authorize-an-org-in-vs-code

https://salesforce.stackexchange.com/questions/251589/unable-to-authorize-salesforce-org-using-sfdx-trailhead

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Ajay K DubediAjay K Dubedi
Hi Parteek,

Yes, there is already one process in running so you have to first kill that process after you can authorize your Org.
You should follow this command in your VS code terminal:

Example: taskkill /PID 13872 /F

For kill VScode process
netstat -ano | findstr :8084

You can also install Task Kill tool from VS code marketplace
- Open up the prompt (F1 \ Ctrl+Shift+P \ CMD+Shift+P) and select: "Task Kill: Kill an active network
  task (by port number)" or simply hit Ctrl + Del (numpad_decimal).
- Type in the port number of the process you want to kill.
- Hit enter.

You can follow this link for more help:
https://marketplace.visualstudio.com/items?itemName=Shynet.vscode-taskkill

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi
Parteek Goyal 3Parteek Goyal 3

Hi Anas/Ajay,

I have tried this, but still facing the same issue.

Thanks,
Parteek

SAKTHIVEL MSAKTHIVEL M

same issue to me, even i tried all https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_troubleshoot_cancel_auth.htm

then not worked for me, so i reinstalled the vsc and installed the plugin and its worked perfectly. but not sure this as the solution, but worth to retry to install and check it.

Thanks
 
Swapnagandha HawaldarSwapnagandha Hawaldar
Ajay,

netstat and taskkill commands helped me sort this issue out. Thanks a lot!
Swapna
Mohammed IliyasMohammed Iliyas
Hi guys,
1.Press Ctrl+Alt+Delete, then click Task Manager.
2.Select the Process tab.
3.Find the process named Node.
4.Select the process that you want to end, and then click End Process.

Hope this will work.
Vidyut DevamVidyut Devam
Hi Ilyas,

I have tried killing the process named node. Now when i tried to authorise the dev hub then this command runs for uncertain time and doesnt open up browser window asking for allow or deny options. 
Any help will be appreciated.

Parteek,
Are you able to get conquer this challenge? if yes then please give hints.

Regards
Vidyut
Hakim Upadhyay 45Hakim Upadhyay 45
Hey Vidyut,

is your problem resolved, I am facing the same issue. It is a endless process, after clicking that Node process
kumar 393kumar 393
Hi All,

I am having an issue and I have set the path C:\Windows\System32 in our environment variables and I had set the environment variable HTTP_PROXY in the Environment Variables section of my windows System Properties to
http://webproxyaddress:8080/. The issue is still not resolved. I keep getting the same error as below.

Starting SFDX: Authorize an Org
11:35:26.773 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=46c1108c2830^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=KaSmJ2QYMtuO06KLUUM1B_3c5FZaUDADD6ugrRaF0h4' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=46c1108c2830^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=KaSmJ2QYMtuO06KLUUM1B_3c5FZaUDADD6ugrRaF0h4' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=46c1108c2830^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=KaSmJ2QYMtuO06KLUUM1B_3c5FZaUDADD6ugrRaF0h4' ] }
{ Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs:
   [ '/c',
     'start',
     '""',
     '/b',
     'https://login.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=46c1108c2830^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=KaSmJ2QYMtuO06KLUUM1B_3c5FZaUDADD6ugrRaF0h4' ] }

I have been struggling from few days on this issue.
Any help is appreciated.
Thanks in advance.
hrushikesh vazehrushikesh vaze
SFDX: Authorize an Org failed to run:

If you are trying to Authorizing an Org, but you are getting an error OR if it keeps loading. 

Resolve it in 2 Steps: 

1. Open Task Manager -> Details -> Delete the process with name 'Node.exe' 
2. Set Microsoft Edge as your default browser. 

#HappyToHelp
Thanks, 
Hrushikesh 

 
Jenie Anne Cabreros 4Jenie Anne Cabreros 4
it really works! thank you
 
Anusha Dommeti 2Anusha Dommeti 2
@hrushikesh vaze , Thank you so much it worked .
sandhya rani 105sandhya rani 105
@
hrushikesh vaze...,node.exe is coming while  trying to Authorizing an Org if i kill the node.exe file . Authorize an Org failing if am doing same thing also plz help me on this
PARAG BHORPARAG BHOR
Bro I am also having the same to same issue, how did you resolve it. I am sick of this problem from past 4 days still no progress. Please help me 
Test cistestTest cistest
I am facing the same issue, please help me.

sfdx force:auth:web:login --setalias ml_09_11_2020 --instanceurl https://login.salesforce.com --setdefaultusername
 ended with exit code 1
sfdx force:auth:web:login --setalias ml_09_11_2020 --instanceurl https://login.salesforce.com --setdefaultusername
ERROR running force:auth:web:login:  spawn UNKNOWN
sunetra parnaiksunetra parnaik
i just deleted the VS code in the task manager and reopened the VS Code app and then clicked again on Authorize Org it worked for me .
sunetra parnaiksunetra parnaik
@test cistest
if you are getting ended with exit code1, it means there is a lightning component in your dev org which exists with teh same name thats why you get the errror. you can delete it from your source org and then re depoy it. It work work.
Hun LowHun Low
Hi All

I had authorize an org working and then somehow it stopped working. Though it did complain about the port, after turning it off and killing the PID,
I still had the port issue, turned out it was not the fix.

It worked at home but not at work (which it used to).
 
Realized our wonderful IT department had put an network protection tool that sniff out and certain blocks URL logins from your PC. Worked out IT put in force point and it stopped working. Had to get them to allow traffic for all saleforce site. Find out first if your IT network people has done something, especially for very large organisation.

Also I notice another thing if I tried to "Retrieve Source org" the code and config, if the data is saved to a network drive it just hangs there trying to retrieve the data. Create your "Project with Manifest" in your local drive and you will have better luck with "Retrieve Source org".  IT network  engineers sure can cause alot of issues without realising it.
Felipe Melo 2Felipe Melo 2
Hi,
if you've a admin profile, on your org, go to settings>users>click in your user and roll down. 
In :
Connected Apps do OAuth, revoke all Salesforce CLI apps with count equals 0.
Try again on VSCode and if it work give a like here.
Estanislao Velazquez Bustamante 9Estanislao Velazquez Bustamante 9

Hello my fellow mortals,
I have decided to grace you all with the ansewer that has been givin to me from the all mighty allStack.

The solution is to put this in the command Promt (windows)

sfdx plugins:install @salesforce/plugin-auth@1.4.3

suchendra chandra 8suchendra chandra 8
Update Salesforce CLI, Give command: sfdx update
Jose Espinosa 3Jose Espinosa 3
Thank you, Suchendra. Using sfdx update solved my issue.
SaiKrupa JSaiKrupa J

Hi,
Im facing same issue . Tried with changing default browser , unintalled and intalled and done SFDX update . But not worked for me.
Still facting the same issue.

Please do needful
Thanks in advance.

 

 

Pankaj BerwalPankaj Berwal
Hi 

I faced the same issue I tried :
1) to kill all processes 
2) Not able to find the Node process in my task manager processes.
3) Restarting vscode
4) Reinstalling SFDX CLI

Finally, the solution that worked for me is,
I used the below command :
sfdx plugins:install salesforcedx@48.22.11
 
DHARSHAN B KDHARSHAN B K
Thank you., @Pankaj Berwal 
I used the below command  to debug an error:
enter below command in VS Code Terminal-
sfdx plugins:install salesforcedx@48.22.11
Monu Sharma 9Monu Sharma 9
Thank you @Suchendra 

By using sfdx update, solved my issue
Siddharth Joshi 4Siddharth Joshi 4
Hi all, If you are still facing this problem then try these steps -

1. Download Salesforce cli and install.

2. Open Command prompt and write - sfdx update. It will update CLI to the latest version.

3. After this go to Vs code and try to authorize again. It should work now.

If it helps, like it. Have a nice day :)




 
rodrigotxrarodrigotxra
Just followed the steps provided by @sunetra and it worked like a gem
ZodiacHealerZodiacHealer

@Pankaj Berwal (https://dfc-org-production.force.com/forums/ForumsProfile?communityId=09aF00000004HMG&userId=0052I00000CP5Da&showHeader=false),

C:\WINDOWS\system32>sfdx plugins:install salesforcedx@48.22.11
 »   Error: The salesforcedx plugin is deprecated.
 »   Installing it manually via 'sfdx plugins:install salesforcedx' is no longer supported and can result in duplicate
 »   commands and outdated plugins.
 »   See https://github.com/forcedotcom/cli/issues/1016 for more information about this change.

Can you help a brother out here?

 

ZodiacHealerZodiacHealer
User-added image
Deepika kareDeepika kare
Thank u, @hrushikesh vaze. After delete  'Node.exe'  it was working fine.
 
Pravallika AkulaPravallika Akula
I was stuck on this glitch for some time, after researching on internet I found the solution and finally I was able to authorise my org through Visual Studio, here is what i did,
open command prompt or terminal and run this command: sfdx update stable-rc 
then ctrl+shift+p --> SFDX:Authorize an Org -->Project Default --> enter alias project name --> click enter
you will be redirected to your org in your browser.
Rahul TakleRahul Takle
Hi all, If you are still facing this problem then follow the below steps -

1. Download Salesforce cli and install.
2. check if sfdx is intall properly or not ( open command prompt and write sfdx and enter )\
3: Set environment variable. Like ( path =C:\Program Files\sfdx\bin)

after that try to Authorize an Org. you will not get the error again.
Karim LaphroaigKarim Laphroaig
Quality assurance and quality control are indispensable components of a successful project. They play a crucial role in ensuring a high level of performance, customer satisfaction and sustainable development of the company. I believe that qa vs qc (https://www.codica.com/blog/quality-assurance-vs-quality-control/) are two closely related, yet distinct aspects integral to achieving high levels of performance and customer satisfaction. It is important to realise that both processes should be applied throughout the project lifecycle. From requirements definition and planning, through development and testing, to implementation and support .
chris thomas 65chris thomas 65
Hey there,
I've faced a similar issue before. After killing the process on port 1717, try restarting Visual Studio Code and then attempt the authorization again. If it still runs indefinitely, consider restarting your machine. Hope this helps! https://authreviews.com/
Ashutosh KrishnaAshutosh Krishna

Hey there Everyone, I faced the same issue after a sandbox refresh, none of the CLI command was working.
check on your terminal if you can see the version of your Salesforce CLI if not just install the salesforce CLI again and replace the path variables with the previous one OR just add the new path variable and delete the previous one.
I hope this works for you as it worked for me.
ALL THE BEST!!

Alefe Pereira TitoAlefe Pereira Tito
 "replace the path variables with the previous one OR just add the new path variable and delete the previous one"         
@Ashutosh Krishna Sorry i didin't got this, can you explaine it with more details? please