-
Notifications
You must be signed in to change notification settings - Fork 196
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
Terminus attempts to reuse expired session token and fails, instead of establishing new session #2561
Comments
Hi! Do you have more than 1 machine token stored in this context? |
No |
I just hit this today as well, I do have two users however. I would expect a more helpful error message or a retry of my past session as well.
|
Hi! I think a good solution for scripts is to make sure you're logged in at the beginning of the script by running:
This should make sure you have a valid session. We will create an internal ticket to investigate this behavior and see if there is a better solution for this |
Every command tagged as
@deltafactory could you share the command that is failing for you? |
I was wondering if excluding expired tokens during the The call in question is a custom wp-cli command. I see that my syntax in the original issue text caused much of that to be eaten so let me fix it. |
@kporras07 Command in Issue desc fixed. The exact command is a proprietary command for a client. If we need a test case that others can replicate, we'll need to figure out something else. |
Tokens in this context is machine token; we don't really have a way to know whether they're revoked or not (they don't expire but you could delete them from your dashboard). If it is only 1 of them (or you have set a user email in your terminus config), it should use this token to reauthenticate. I just looked at the Could you please post the output of |
The token I'm having issue with is the session token, not the machine token. I apologize if I'm not using the correct terminology. From the code excerpt, I thought |
yeah, if a session is expired, for most commands that need authentication, it should use a machine token to generate it. Could you please post the output of terminus machine-token:list ? (Feel free to mask the info you don't feel comfortable pasting here, please) |
Platform
( ) MacOS
(X) Linux
( ) WSL2
Installed Via
( ) Homebrew
( ) Apt Package
(X) Manually
PHP Version
(X) 7.4x
( ) 8.0
( ) 8.1
Terminus Version
v3.3.5
Command Executed
terminus -vvv wp SITE.live -- [WP CLI command and parameters]
Expected behavior
Terminus should either re-use the existing valid session or establish a new session using the machine token.
Actual behavior
This is running as a daily cron job. Normally the command works as expected. Every few days the job end in an error message:
[error] Could not locate a site your user may access identified by XXXXX: Invalid or expired session header: X-Pantheon-Session
The next daily run executes as expected. From what I can tell, a session is established and stored in .terminus/cache/sessions. The session expires in a few days from issue. Subsequent runs during the valid period do not extend the expiration date so that eventually an attempt is made after expiration. Terminus makes no attempt to use other stored machine-tokens to revalidate before exiting with the error provided.
The text was updated successfully, but these errors were encountered: