Search code examples
reactjsherokushopifycreate-react-appshopify-app

Error when deploying Shopify React App with Heroku


I'm building a Shopify public app with a Firebase database. Everything works locally, but when I deploy it on Heroku, it doesn't authenticate, and the app displays an error.

enter image description here

The log is displaying an error message.

enter image description here

I'm following these tutorial https://medium.com/code-undefined/how-to-deploy-your-shopify-react-app-to-heroku-5dbc5a51738

Here is my server.js https://github.com/amit-codeking/notification-bar/blob/master/server/server.js

Thanks in advance for you help!


Solution

  • The app is looking for the API_SECRET_KEY config value to be defined, but it is not. This is causing the params.API_SECRET_KEY.length line to error, as it cannot call .length on params.API_SECRET_KEY due to it resolving as undefined.

    You can follow the Heroku documentation to add this config value to your Heroku app. It seems as though the blog has it mislabeled as SHOPIFY_API_SECRET_KEY so you may just need to rename that config value to match what your application is expecting. You may hit the same error with SHOPIFY_API_KEY just being API_KEY as well, so be on the look out.

    heroku config:set API_SECRET_KEY whateverYourKeyIs