Typeerror: scopesArray.map is not a function when using postgresql

I’m creating an Shopify app using Node with SQLite it’s working fine on local and also when deploy on Heroku too.

but now I’m going to use PostgreSQL instead of SQLite as you know Heroku reset SQLite on each deployment so i decide to use PostgreSQL for production so i successfully setup using

@shopify/shopify-app-session-storage-postgresql

session details are successfully stored in database but application crashed when reached at

// All endpoints after this point will require an active session
app.use("/api/*", shopify.validateAuthenticatedSession());

for validation and show error

/node_modules/@shopify/shopify-api/lib/auth/scopes/index.js:15
 .map(function (scope) { return scope.trim(); })

TypeError: scopesArray.map is not a function

node_modules/@shopify/shopify-app-express/build/cjs/middlewares/validate-authenticated-session.js:57:79

Please guide me how can i shift from SQLite to PostgreSQL or it’s somethings wrong from my side.

Same error

This is happening because you are installing the** @Shopify_77 /shopify-app-session-storage-postgresqlpackage in the top directory and not in the /web directory. This is causing a conflict with having duplicate @Shopify_77 /shopify-api**instances.

Moving this from top level package.json to the /web package.json and npm install should fix this. Found the solution here - https://github.com/Shopify/shopify-app-template-node/issues/1208