2

Currently I am unable to authorize an org due to the below error.

Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.

I have tried below solutions but it's not resolved.

Solution 1 : I have tried to kill the process in the task manager but there is nothing running on port 1717. Solution 2 : In the cmd I tried finding the task by running the command netstat -ano|findstr "PID :1717" and killed the task. but after that getting another error.

{ 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://test.salesforce.com//services/oauth2/authorize?response_type=code^&client_id=PlatformCLI^&redirect_uri=http%3A%2F%2Flocalhost%3A1717%2FOauthRedirect^&state=451887445146^&prompt=login^&scope=refresh_token%20api%20web^&code_challenge=gjWHT_AYIT0yXb4EJzshQJRgojLGn0yWAiM781vKs10' ] }
2
  • Have you tried restarting your device and trying again?
    – sfdcfox
    Dec 4 '19 at 4:33
  • i have restarted the device and tried again but it's not working.
    – Ana
    Dec 4 '19 at 7:00
2

Try with below option ;

  • Go to the windows task manager.
  • Search for node.js running application, might need to scroll down and there you can find it.
  • Kill the process.

Hope this helps!

1
1

The error message indicates, Port 1717 is not available for use on your machine.

Option 1:

  • You can Kill the Job Running on the port Windows: netstat -ano | findstr :yourPortNumber taskkill /PID typeyourPIDhere /F

More about it: https://stackoverflow.com/questions/39632667/how-to-kill-the-process-currently-using-a-port-on-localhost-in-windows

Mac: sudo lsof -i :3000 kill -9 PID

Option 2:

  • Change the Port in the sfdx-project.json file by including "oauthLocalPort": portNumber(any available port) in the JSON
1

For Mac OS you can resolve the problem by finding the PID for the process using port 1717 by entering the following command in terminal lsof -i tcp:1717. After you get the PID, you can run kill -9 <ENTER PID>

0

I'm trying to combine different ways that are already mentioned in the answers and comments. I'm also adding some explanation.

Use the terminal to find out what's occupying the port in question by the following command in mac (use zsh preferably),

lsof -i tcp:1717

You'll get something like the following if the port is occupied by a process (in this case it's port 1717),

COMMAND   PID       USER   FD   TYPE             DEVICE  SIZE/OFF  NODE NAME
node    44009 <username>   25u  IPv4      <device code>       0t0   TCP localhost:<some id> (LISTEN)

Use the PID from the result and replace in the following command and run the command in terminal to kill the process that's occupying the port,

kill -9 <PID>

This has happened to me mostly when I try to authorize a new org and for some reason, it fails or just hangs and then I try again and that's when the previous org-auth request is still using the port.

If the port is being used by a process that you don't want to kill, then do the following to have vscode-dx use a different org for authorizing,

find the file called sfdx-project.json in the root directory of your project. Add this key value pairs into it, "oauthLocalPort" : <port number> replace <port number> with the port you want vscode-dx use for authorizing. Save this file (make sure the port is free).

Also if you have pending updates for the salesforce extension pack or any of its dependency extensions, it's better to first update those and reset vscode before doing this.

I hope this helps! 🍻

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.