question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode SFDX: Authorize an Org fails with EACCES error

See original GitHub issue

Summary

SFDX: Authorize an Org fails with EACCES error.

Steps To Reproduce:

  1. Open VS code with no project
  2. Issue command SFDX: Create Project
  3. Name the project VSCodeQuickstart (for instance)
  4. In file project-scratch-def.json change orgName to Learning VS Code
  5. Issue command SFDX: Authorize an Org
  6. Accept default login URL
  7. Enter alias VS Code Playground (for instance)

Expected result

Browser window should open to authorize access.

Actual result

Browser does not open. Instead, the Output panel reads:

Starting SFDX: Authorize an Org

11:38:21.734 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername
{ 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 }
{ 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 }
11:38:23.839 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername ended with exit code 0

Additional information

  • Tried this over two different networks.
  • First as normal user, then as admin.

VS Code Version: 1.33.1

SFDX CLI Version: sfdx-cli/7.5.0-e6ca93eee8 win32-x64 node-v10.15.3

OS and version: Windows 10 (Windows_NT x64 10.0.17763)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
rendallcommented, May 21, 2019

There is one final piece to the puzzle, and it definitely is a bug. The oauthLocalPort is ignored at callback, and it uses the 1717 port.

To reproduce:

  • set oauthLocalPort to anything working not 1717
  • type the command sfdx force:auth:web:login -d -a DevHub
  • authorize at the login screen
  • note that the redirect is to http://localhost:1717/OauthRedirect?code=aPrxrDqe....

This redirect should be to the oauthLocalPort set in sfdx-project.json

The workaround is to replace the 1717 in the browser url with the alternate port.

5reactions
DFKAcommented, May 21, 2019

An alternative approach that seems to work is to restart in safe mode with networking enabled and add 1717 to your own range, and then restart back to normal.

netsh interface ip add excludedportrange protocol=tcp startport=1717 numberofports=1

Read more comments on GitHub >

github_iconTop Results From Across the Web

SFDX: Authorize an org error: listen EACCES: permission ...
Administered Port Exclusions are the reason. In the Salesforce CLI log, you also see: error: listen EACCES: permission denied 127.0.0.1:1717.
Read more >
Issue with SFDX: Authorize an Org in vscode
Hi All, I am trying to authorize an org using vscode. I am getting the following error. { Error: spawn cmd ENOENT at...
Read more >
Authorize an org error: listen EACCES: permission denied ...
Authorizing an org either through command palette or with a command in terminal had never been a problem [Command is like this: sfdx...
Read more >
SFDX Authorize an Org failed to run - Stack Overflow
After re-installing Salesforce CLI and running the command sfdx from the Terminal window, I am still getting this error: "/Users/eduardo/.local/ ...
Read more >
Salesforce Tips - Resolve Org Authorization Error in VS Code
In this blog we will discuss how to resolve the Authorization error while executing SFDX command “Authorize an Org” in VS Code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found