0

I have been using DX for quite some time. Authorizing an org either through command palette or with a command in terminal had never been a problem [Command is like this: sfdx force:auth:web:login --setalias mySandbox --instanceurl https://test.salesforce.com ]

Today while trying to authorize a sandbox, I encountered the following error message which seems to be from node.js:

{ Error: listen EACCES: permission denied 127.0.0.1:1717 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10) code: 'EACCES', errno: 'EACCES', syscall: 'listen', address: '127.0.0.1', port: 1717 } { Error: listen EACCES: permission denied 127.0.0.1:1717 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10) code: 'EACCES', errno: 'EACCES', syscall: 'listen', address: '127.0.0.1', port: 1717 } { Error: listen EACCES: permission denied 127.0.0.1:1717 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at GetAddrInfoReqWrap.doListen [as callback] (net.js:1451:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10) code: 'EACCES', errno: 'EACCES', syscall: 'listen', address: '127.0.0.1', port: 1717 }

Recently I have done several changes to my Desktop and I do not know if it has something to do with them:

  1. O.S. updated to Windows 10 [Version 10.0.18363 Build 18363]
  2. Installed Docker Desktop
  3. Installed Gitlab-runner

If not, how can I solve this problem?

Thank you.

1
  • Following some answers on the internet, I added "oauthLocalPort" : "7717" to the file "sfdx-project.json". Then when it redirects back to localhost, I modified the port from "1717" to "7717". Then it works. Even with this workaround I am still very curious about why 1717 used to work but now it stops working. I have looked at Resource Monitor and it seems no process is occupying the port 1717. Commented Feb 24, 2020 at 10:39

5 Answers 5

1

Administered Port Exclusions are the reason.

In the Salesforce CLI log, you also see:

error: listen EACCES: permission denied 127.0.0.1:1717

Run this in a Cmd Prompt:

> netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
        80          80
       443         443
       808         808
      1068        1167
      1168        1267
      1268        1367
      1473        1572
      1573        1672
      1673        1772
      5357        5357
     11821       11920
     11921       12020
     12263       12362
     12363       12462
     12463       12562
     12563       12662
     16013       16013
     20807       20807
     22221       22221
     22223       22223
     37408       37408
     50000       50059     *

* - Administered port exclusions.

You can see port 1717 is in a blocked range (1673 to 1772) I changed mine to 1771 by ading this line to sfdx-project.json:

"oauthLocalPort": "1771",

and it worked OK - sort of.

In the Browser, I still got the error: enter image description here

But, when I looked, I saw it was still trying to use pot 1717. I edited the URL in the browser to the new Port I had selected (1771 in my case - yours may be different) and it worked - the callback to VS Code completed and I was logged in to SF and could down load my code.

See https://stackoverflow.com/questions/58216537/what-is-administered-port-exclusions-in-windows-10 for more about 'Administered Port Exclusions'

1
  • Great. This is a workaround I usually use as well... Now I know that port 1717 is within the blocked range. But I wonder why it is like that. If this is default in every PC, why doesn't SFDC set a port as default other than "1717"? Commented Jan 29, 2021 at 7:24
1

This was my solution, https://superuser.com/questions/1579346/many-excludedportranges-how-to-delete-hyper-v-is-disabled

I had to stop the winnat service with the following command via an elevated administrator command line:

net stop winnat

The reserved port range shows up via the netsh command but the specific 1717 port isn't seen as open by netstat

1

Recreating the SFDX project (overwrite the original folder) resolves the issue for me. It's wired..

0

There must be a process running on port 1717,

Option 1:

You can Kill the Job Running on the port Windows: netstat -ano | findstr :yourPortNumber taskkill /PID typeyourPIDhere /F More about the command: https://stackoverflow.com/questions/39632667/how-to-kill-the-process-currently-using-a-port-on-localhost-in-windows

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

Option 2:

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

to find open ports on windows: Run resmon.exe, switch to the network and listening ports use a port not listed. **Mac:**simply use netstat -ap tcp

2
  • Hi Abhijith, thanks for your answer. But "netstat -ano | findstr :1717" returns nothing. I have done this many times but it was in vain. And yes I have found the workaround by applying option 2. But I still would like to know why option 1 would fail given that it had always been fine before. Commented Feb 25, 2020 at 2:33
  • usually, a node process was running on port 1717 in my case which I had kill by going to processes.... and then it worked for me but i also needed node process to be on so switched the port in my case
    – Abhijith E
    Commented Feb 25, 2020 at 8:54
0

Try to run SFDX Auth from CMD as admin

sfdx force:auth:web:login --setalias [alias] --instanceurl https://login.salesforce.com --setdefaultusername

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .