---
schema_version: "1"
id: b6b2bf99f9bc296864b8594c6981ddaba6f45359c651cc206f91fb28376051f0
title: Hybrid Stability Upgrade for PWA Kit Version 2.x
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/pwa-kit-managed-runtime/guides/hybrid-upgrade-v2.x.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/hybrid-upgrade-v2.x.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 439089e3bae056bab377ae1ce4c0c3dd61e6f74ec7458428d9927acd498e9d3d
products:
  - Composable Storefront
  - Salesforce APIs
---
# Hybrid Stability Upgrade for PWA Kit Version 2.x

This guide explains how to make and verify code changes in a [hybrid storefront](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/hybrid-implementation.md) to:

- Update a Progressive Web App (PWA) Kit project on version 2.8.4 or earlier to implement hybrid stability. This potentially improves the performance of baskets.
- Upgrade from Plugin Shopper Login and API Access Service (Plugin SLAS) version 7.3.0 or later to version 7.4.0.

We recommend testing the steps in a non-production environment before deploying your changes to production.

**tip:** Only existing customers can access some of the links on this page. Visit [Salesforce Commerce Cloud GitHub Repositories and Access](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-github-repo-access.html) for information about how to get access to the repositories.


**note:** - The steps in this guide apply to a hybrid storefront that uses [Plugin SLAS](https://github.com/SalesforceCommerceCloud/plugin_slas). With B2C Commerce version 25.3, hybrid authentication (auth) replaces Plugin SLAS. For more information, see [Configure a Hybrid Storefront with Hybrid Auth](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/hybrid-auth.md).
- This guide applies to hybrid storefronts built in part with PWA Kit version 2.8.4 or earlier. For the steps that apply to PWA Kit version 3.x, see [Hybrid Stability Upgrade for PWA Kit Version 3.8.0](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/hybrid-upgrade-v3.x.md).

## What’s New

To improve stability and performance for hybrid storefronts, we:

- Removed calls to `OCAPI /sessions` from PWA Kit to eliminate session churn (frequent changes to `dwsid`). For more information about `dwsid`, see [Understand Session Management between SFRA and PWA Kit](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html?q=dwsid#understand-session-management-between-sfra-and-pwa-kit).
- Added a header (`sfdc_dwsid`) to Salesforce Commerce API (SCAPI) calls to send the `dwsid` to SCAPI to ensure that requests from a given shopper session are routed to the same app server.
- Removed the Open Commerce API (OCAPI) proxy from the PWA Kit configuration, which makes PWA Kit fully SCAPI-based.

## Prerequisites

If you haven’t already done so, complete these steps.

- [Set Up SLAS for PWA Kit](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html#1-set-up-slas-for-pwa-kit).
- Set Up [Session Bridging](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html#2-session-bridging).
- Configure [Routing](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html#3-routing). See also [CDN Routing Rules for Hybrid Implementations](https://developer.salesforce.com/docs/commerce/commerce-api/guide/ecdn-rules-for-phased-headless-rollout.html).
- Make [Other Changes to PWA Kit Projects](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html#5-other-changes-to-pwa-kit-projects).

## Submit a Support Request

Open a support case that asks Salesforce Customer Support to enable Session Override for dwsid. In the support case:

- Request to enable both parent and child toggles.
- Mention your correct realm ID and tenant ID. If you don’t know your realm ID, ask your Account Executive or Customer Success Manager.

## Make PWA Kit Code Changes

If you're using PWA Kit version 2.8.4 or earlier, complete these steps in your project.

1. Check the diff between these files in your project and the files changed in this [pull request](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2036/files).

   - `template-retail-react-app/app/commerce-api/auth.js`
   - `template-retail-react-app/app/commerce-api/index.js`
   - `template-retail-react-app/app/commerce-api/utils.js`

2. Update your project with the new and changed code in the pull request.

## Make Plugin SLAS Code Changes

If you're using Plugin SLAS version 7.3.0 or later, complete these steps.

1. In `cartridges/plugin_slas/cartridge/controllers/Login.js`:

   - Remove the `access_token` cookie after logout in the `/Login-Logout` controller
   - Add `config.ACCESS_TOKEN_COOKIE_NAME` to the `cookiesToRemove` array in the `/Login-Logout` controller.

2. In `cartridges/plugin_slas/cartridge/scripts/helpers/slasAuthHelper.js`, update the `removeCookie` function to remove any existing chunks of cookies:

   - Change the condition from exact match (==) to `.startsWith`.

3. In `cartridges/plugin_slas/cartridge/scripts/hooks/request/onSession.js`, update the `onSession` hook implementation for the new guest shopper flow:
   - Extract the `dwsid` from `x-is-session_id header` into a variable.
   - Use the variable in the call to `getSLASAccessTokenForGuestSessionBridge`.
   - Set the `dwsid` cookie to the response for new guest shoppers.

See the files changed in this [pull request](https://github.com/SalesforceCommerceCloud/plugin_slas/pull/207/files?diff=split).

## Verify Your Code Changes

1. Confirm that PWA Kit isn’t making calls to `OCAPI /sessions`.

   - Go to your storefront and clear all site data.

     If you’re using Chrome DevTools, see [Delete all cache data](https://developer.chrome.com/docs/devtools/storage/cache#deletecache).

   - Refresh your storefront or go to any page that’s PWA Kit-based and inspect the Network Tab in Chrome DevTools. Confirm that you don’t see requests being made to `dw/shop/<version>/sessions`. See this example from Chrome DevTools.

![No Sessions](https://developer.salesforce.com/docs/media/pwa-kit-managed-runtime/no-sessions.png)

2. Confirm that `dwsid` is sent with all SCAPI requests.

   - Go to your storefront. Visit any SFRA/SG-based page then go to a PWA Kit-based page.
   - If you’re using Chrome DevTools:
     - Open Cookie Storage and look for `dwsid` value in the cookies. See [Open the Cookies pane](https://developer.chrome.com/docs/devtools/application/cookies#open).
     - Open the Network Tab and inspect any SCAPI request (for example, `/baskets`). In the Request Headers, confirm that you see the `sfdc_dwsid` header with the value same as the `dwsid` that you found in the previous step. See this example from Chrome DevTools.

![No Sessions](https://developer.salesforce.com/docs/media/pwa-kit-managed-runtime/dwsid3.png)

## See Also

- [Configure a Hybrid Storefront with Plugin SLAS](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.md)
- [Build Baskets and Place Orders](https://developer.salesforce.com/docs/commerce/commerce-api/guide/work-with-baskets-orders.html)
- [Get Started with the B2C Commerce API (SCAPI)](https://developer.salesforce.com/docs/commerce/commerce-api/guide/scapi-get-started.html)
- [Configure a Hybrid Storefront with Hybrid Auth](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/hybrid-auth.md)
- [Get Started with Composable Storefront](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-developer-workflow.md)
