Issue with session termination when bulk uploading photos/inventory item edits

Solved

Issue with session termination when bulk uploading photos/inventory item edits

BLuurr
Shopify Partner
4 0 0

The issue tends to happen at random intervals regardless of the method I use to create the session. My best luck has been with tokens lasting the longest, but the session is inevitably terminated. I do not receive any specific error, and it appears to be at random. Currently, I am using llib3 and HTTPAdapter in Python to connect and its been the most stable. 


Accepted Solution (1)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi BLuurr,

 

It seems like you're experiencing intermittent issues with session termination. Here are some potential solutions and things to look out for:

  1. Token Expiration: According to the documentation, session tokens have a lifetime of one minute. You may need to fetch new session tokens using Shopify App Bridge for each request to ensure stale tokens aren't used.

  2. Error Handling: Make sure you have appropriate error handling in place. This can help you catch and log exceptions, which can provide insights if the sessions are failing due to specific errors.

  3. Concurrency Issues: If your application is handling multiple requests concurrently, make sure that your session handling is thread-safe.

  4. Server Time Sync: Ensure that your server time is synced. JWT token verification can fail if your server's time is significantly ahead or behind.

  5. Network Issues: Intermittent network issues can also cause random session termination.

  6. Session Storage: If you're storing session information in a database or some other storage, ensure that the storage system is working correctly and efficiently.

If you've checked all these and the issue persists, let us know and we'll look into this specific case further. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi BLuurr,

 

It seems like you're experiencing intermittent issues with session termination. Here are some potential solutions and things to look out for:

  1. Token Expiration: According to the documentation, session tokens have a lifetime of one minute. You may need to fetch new session tokens using Shopify App Bridge for each request to ensure stale tokens aren't used.

  2. Error Handling: Make sure you have appropriate error handling in place. This can help you catch and log exceptions, which can provide insights if the sessions are failing due to specific errors.

  3. Concurrency Issues: If your application is handling multiple requests concurrently, make sure that your session handling is thread-safe.

  4. Server Time Sync: Ensure that your server time is synced. JWT token verification can fail if your server's time is significantly ahead or behind.

  5. Network Issues: Intermittent network issues can also cause random session termination.

  6. Session Storage: If you're storing session information in a database or some other storage, ensure that the storage system is working correctly and efficiently.

If you've checked all these and the issue persists, let us know and we'll look into this specific case further. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

BLuurr
Shopify Partner
4 0 0

I couldn't figure out exactly what the problem was, but I did find a work around. I simply created a new session and fetched a new token after each request, while retaining my cursor after each request+session. This was in conjunction to the other issue of mine that you responded to.