Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"INVALID_SESSION_ID: Session expired or invalid" during force:source:push #899

Closed
SCWells72 opened this issue Mar 5, 2021 · 13 comments
Closed
Labels
investigating We're actively investigating this issue

Comments

@SCWells72
Copy link

Potentially 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 [email protected] --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.

@SCWells72 SCWells72 added the investigating We're actively investigating this issue label Mar 5, 2021
@github-actions
Copy link

github-actions bot commented Mar 5, 2021

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@amanrawat1993
Copy link

I think this issue is similar to this issue, #881.
My friend was facing this and we changed the CLI version using below commands taken from the mentioned issue and now it is working fine.

sfdx plugins:install [email protected]
sfdx plugins:install [email protected]

@maaaaarco
Copy link

Yeah same issue here... I thought my Scratch Org had expired so I run force:org:list... The scratch was still active and the next push was successful. Seems there's an issue in refreshing the token...

@Szandor72
Copy link

Same here. I get Session expired or invalid on push if I open up my project in VS Code the first time. After opening my current Scratch Org (from vs code), push works again.

@aheber
Copy link

aheber commented Mar 12, 2021

I'm not sure but I have been experiencing this since sometime last year. I haven't looked at the code but my understanding is that this was caused by some changes made in response to JWT authentication in CI when the JWT token was taken away after initial authorization. I think the change causes source:push not to be able to get a new token and just try and use the token already available, it is missing the ability to refresh if the current access token is expired.

I don't think this had a specific resolution attached but this was some of the discussion: #81

I think there was another ticket where the resolution was discussed but I can't find it right now.

@shetzel
Copy link
Contributor

shetzel commented Mar 16, 2021

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.

@Triopticon
Copy link

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?

@fransf-wtax
Copy link

fransf-wtax commented Apr 8, 2021

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

This is interesting. We contacted support and they sent us to this issue. It doesn't look like there's any appetite on Salesforce's side to fix this obvious regression in the CLI. Wondering if it's a new direction SF is taking where they've got so much money now, they think their customers don't matter anymore. Let's see...

@willcobbett
Copy link

Also experiencing this issue

@brianevanmiller
Copy link

Same here, also have this issue across different production orgs 😞

@fransf-wtax
Copy link

This has now been acknowledged by Salesforce as a known issue. Please "vote" for it by clicking the This Issue Affects me button on https://success.salesforce.com/issues_view?id=a1p4V000001Zh1GQAS. Thanks!

@github-actions
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@mshanemc
Copy link
Contributor

mshanemc commented Dec 9, 2021

This was all related to this #942

You might still be able to achieve this error by intentionally using the metadata rest api option. If that happens, stop using the rest option.

@mshanemc mshanemc closed this as completed Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests