Deploying Sales channel in Amplify

bhagya19
Tourist
8 0 3

Hi,

We are building a sales channel for one of our merchants. We started off building a public app (which is converted to Sales channel) using the tutorial https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react

We have implemented OAuth to connect the app with the store. Since this is a Sales channel, we need access to the storefront API. Hence, to fetch storefront access token using the access token generated from OAuth, in the _app.js we have used getInitialprops to make the admin api call to fetch the storefront access token.

All of these works fine in our local setup - we are able to spin up the sales channel, view the products there. When we try deploying the sales channel app to Amplify, we see 'AccessDenied'.

bhagya19_0-1620873323952.png

 

Here are our configs - 

_app.js - 

 

MyApp.getInitialProps = async ({ ctx }) => {
    // Obtain StorefrontAccessToken
    
    return {
      storefrontAccessToken: storeToken
    }
  }

 

package.json - build - "next build && next export"

amplify.yml

 

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: out
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

 

bhagya19_0-1620867515273.png

 

0 Likes