401 Unauthorized error when running local app with Shopify CLI

I am creating a custom Shopify app using Shopify CLI.

  • Installed CLI and created a local project (shopify app create node).

  • Created a store and an app in the Partner Dashboard.

  • Linked the app to the project and ran the command shopify app dev.

After starting, the app in the store does not open and shows the message “Handling response”. In the developer console I see a request that fails with the error 401 Unauthorized. There were no errors in the console.

What I tried:

  • Checked all environment variables (SHOPIFY_API_KEY, SHOPIFY_API_SECRET, HOST, SCOPES).

  • Restarted and created a new project.

  • Created a new Partner account and a new store.

  • Deleted and reinstalled the app in the store.