Custom session storage using Node code from CLI 3.x

I’m moving our app code into the app framework generated by Shopify CLI 3.x . I can’t find any documentation on how to implement custom session storage. The way we we’re doing it is:

const sessionStorage = new Shopify.Session.CustomSessionStorage(
myStoreCallback,
myLoadCallback,
myDeleteCallback
);

I know that there are two new handlers required (deleteSessions, findSessionsByShop) but cannot find how to create the SessionStorage object as Shopify.Session.CustomSessionStorage constructor no longer exists.

If there is any documentation available please provide a link; failing that please tell me how to create the custom session storage object.

Many thanks!

1 Like

I have the same issue. It’s really tough having to keep up with changes to the api without sufficient documentation.

Turns out there’s a tab under partner interface called “Team”

You could give another dev permission to the app you are building.

That’s not answering the actual problem.

@dbleeker Here’s what I did. Created a CustomSessionStorage class:

export class CustomSessionStorage {
  async storeSession(session) {...}

  async loadSession(id) {...}

  async deleteSession(id) {...}

  async deleteSessions(ids) {...}

  async findSessionsByShop(shop) {...}
}

Create an instance in your shopify config:

sessionStorage: new CustomSessionStorage()

All return values for the class methods are described here: https://github.com/Shopify/shopify-app-js/blob/main/packages/shopify-app-session-storage/implementing-session-storage.md

Good luck :slightly_smiling_face: