"INVALID_SESSION_ID: Session expired or invalid" during force:source:push
See original GitHub issuePotentially important qualification: I’ve been working with Shane McLaughlin to help verify the new org
commands, so those were installed when this happened.
Yesterday I ran into a situation where a call to sfdx force:source:push
resulted in the following error:
$ sfdx.cmd force:source:push -u test-acfy6mfpibdg@example.com --json
{
"status": 1,
"name": "Error",
"message": "INVALID_SESSION_ID: Session expired or invalid",
"exitCode": 1,
"commandName": "SourcePushCommand",
"stack": "Error: INVALID_SESSION_ID: Session expired or invalid
at Request._callback (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\salesforce-alm\\dist\\lib\\core\\force.js:590:29)
at Request.self.callback (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\request\\request.js:185:22)
at Request.emit (events.js:315:20)
at Request.<anonymous> (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\request\\request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage.<anonymous> (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\request\\request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)\nOuter stack:
at Function.wrap (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\@salesforce\\core\\lib\\sfdxError.js:171:27)
at SourcePushCommand.catch (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\salesforce-alm\\dist\\ToolbeltCommand.js:248:46)
at async SourcePushCommand._run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\@salesforce\\command\\lib\\sfdxCommand.js:85:13)
at async Config.runCommand (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\@oclif\\config\\lib\\config.js:173:24)
at async Main.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\@oclif\\command\\lib\\main.js:27:9)
at async Main._run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\node_modules\\@oclif\\command\\lib\\command.js:43:20)
at async Object.run (C:\\Users\\Scott\\AppData\\Local\\sfdx\\client\\7.89.2-d1d2614d02\\dist\\cli.js:121:21)",
"warnings": []
}
The immediate next execution of the same command completed without issue. Generally (i.e., with close to 100% consistency) commands refresh the access token if necessary before executing, so it was surprising to see this happen all of a sudden.
I’m happy to provide any additional diagnostic info I can, but given that I’ve only seen this once, it’s going to be difficult to provide steps to reproduce, or even to reproduce it myself locally.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Error: INVALID_SESSION_ID: Session expired or invalid ...
I ran into this issue after I had to change my password in the sandbox. I just ran this command to fix it:...
Read more >SFDX org sessions expiring - Salesforce Developer Community
Since a week or so I suddenly get `INVALID_SESSION_ID: Session expired or invalid` errors when trying to deploy to a sandbox.
Read more >Session Id is invalid or has expired - Nintex help documentation
Session Id is invalid or has expired. Issue. You run a DocGen Package and see this message: The included Salesforce Session Id is...
Read more >API call Integration Fails after Enabling Enhance Domain with ...
... Integration Fails after Enabling Enhance Domain with Error: [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}].
Read more >Salesforce Application Scope Issue - Session Expired or ...
Hi Chintan,. Not sure if you have resolved this issue. The Salesforce activity scope has a tendency to expire or throw invalid session...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The REST API does not auto-refresh like it does with SOAP via jsforce. This is a bug and is being tracked internally with W-9016781.
The problem with “Error: INVALID_SESSION_ID: Session expired or invalid” is getting very annoying as it happens with not very long inactivity, and then you need to get the access token refreshed again by for instant using:
sfdx force:org:open -u username
This happens several times a day for the same user/org.
Are there changes done to the authentication model that I have not caught?