stencil-cli icon indicating copy to clipboard operation
stencil-cli copied to clipboard

not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 403 - Stencil CLI version 3.4.0

Open r742davis opened this issue 3 years ago • 14 comments

Expected behavior

Upon running stencil start I am expecting the local development environment to start on the store I am customizing. It is saying I am not authorized (error 403) but I reconfirmed the Access Token and Store URL with the store owner. I was working on this theme about a month ago and there have not been any major updates since then.

Another developer on my team was able to run stencil start with no errors. He is running an older version of Stencil CLI (3.1.0) and when I downgraded to that version, I was able to run stencil start successfully. It also did not work on Stencil version 3.3.0.

Actual behavior

"not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 403" - Stencil does not run.

Steps to reproduce behavior

Node Version: 12.22.1 NPM Version: 6.14.12 Stencil Version: 3.4.0 Store Theme: Cornerstone (customized)

Ran stencil init, saved Access Token, Store URL, and ran on Port 3000. Immediately ran stencil start and received the following error:

not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 403

Downgraded to v3.1.0, ran stencil start, local development environment started successfully but did give some warnings in the terminal:

(node:35433) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.

r742davis avatar Jul 29 '21 20:07 r742davis

Yes, had the same problem and downgrading to V3.1.0 was the answer. BIG thanks!

db-ig avatar Aug 04 '21 14:08 db-ig

Confirmed stencil-cli v3.2.1 also works. The problem started in v3.3.0.

Update: sencil-cli 3.2.1 will let me "stencil start" but no push or download. Same 403 error. Downgrading to 3.1.1 fixes the issue.

mrazzari avatar Aug 27 '21 01:08 mrazzari

I'm having this problem too. Thanks bigtime for posting this fix!

I hate having to ask, but what's the command to install a previous version of stencil CLI? I can't seem to find it anywhere in the documentation? All I'm finding is the standard npm install -g @bigcommerce/stencil-cli

@Northwest-Website-Development No problem, it was driving me nuts!

Run this command in your Terminal to install a previous version: npm install -g @bigcommerce/[email protected]

The is added to the end with an '@' symbol.

r742davis avatar Aug 31 '21 19:08 r742davis

@r742davis -- can't thank you enough!

+1 Same issue on certain stores

FrooAPinner avatar Sep 13 '21 15:09 FrooAPinner

I fixed this issue by creating new a store API account then rerunning stencil init with the new credentials.

tomdiggle avatar Sep 17 '21 21:09 tomdiggle

@r742davis on downgrading to v 3.1.1 or 3.1.0 , i am getting following error:

not ok -- Error: Error: You are using an outdated version of stencil-cli, please run $ npm install -g @bigcommerce/stencil-cli

Any Suggestions???

rs-ritu avatar Sep 20 '21 09:09 rs-ritu

Same experience as rs-ritu. Requested a new Stencil Token from client....hoping it works although I'll have to do this with many clients.

Anyone else find a work around?

brodsolutions avatar Sep 20 '21 18:09 brodsolutions

The issue is a 403 which means you are Forbidden, here is a list of the status codes: Status Codes

Downgrading to a lower version is not a solution, it's a temporary fix which can fail as some of you might get an error like: not ok -- Error: Error: You are using an outdated version of stencil-cli, please run $ npm install -g @bigcommerce/stencil-cli

To fix this, you'll need to create a newer API account version.

  • Log in as the store owners in bigcommerce.
  • Advance Settings > API Accounts
  • Create API Account
  • Select Create V2/V3 API Token
  • Name it whatever you want, "Theme Update"
  • Select the permissions you want
  • Select Save at the bottom right
  • Copy the token key
  • In terminal, type: stencil init
  • The URL should already be in so just press enter
  • Paste the new token
  • GG

You now can use all the stencil commands: stencil start

Good luck all!

royjulien avatar Sep 22 '21 19:09 royjulien

Hi, I have fixed this issue by creating a new API account with specific permission. This often happens to stores with multiple chanels. Here is the solution

    1. Log in as the store owners in bigcommerce.
    2. Advance Settings > API Accounts
    3. Create API Account
    4. Select Create V2/V3 API Token
    5. Name it whatever you want, "XYZ"
    6. Set the Permission **Sites & Routes** to read-only
    6. Select other permissions you want
    7. Save the setting
    8. Copy the token key
    9. In the terminal, type: stencil init
    10. Add the details
    11. Paste the new token
    12. You now can use all the stencil commands: stencil start
    13. Here you might need to select a store if there are multiple stores.
    

CT-Talha avatar Oct 07 '21 14:10 CT-Talha

for me , the .env is missing in the root folder , so I just add it with "enterprise" as value. So it work now

Rajaotix avatar Oct 26 '21 11:10 Rajaotix

Hi, I have fixed this issue by creating a new API account with specific permission. This often happens to stores with multiple chanels. Here is the solution

    1. Log in as the store owners in bigcommerce.
    2. Advance Settings > API Accounts
    3. Create API Account
    4. Select Create V2/V3 API Token
    5. Name it whatever you want, "XYZ"
    6. Set the Permission **Sites & Routes** to read-only
    6. Select other permissions you want
    7. Save the setting
    8. Copy the token key
    9. In the terminal, type: stencil init
    10. Add the details
    11. Paste the new token
    12. You now can use all the stencil commands: stencil start
    13. Here you might need to select a store if there are multiple stores.

this is not working for me

sanjay-makwana-avidbrio avatar Nov 10 '21 12:11 sanjay-makwana-avidbrio

In My Case I was using "Create Stencil-CLI Token" then I delete it and I created a different API token with the option "Create V2/V3 API Token". I followed the instructions below and it worked for me.

1. Log in as the store owners in bigcommerce.
2. Advance Settings > API Accounts
3. Create API Account
4. Select Create V2/V3 API Token
5. Name it whatever you want, "XYZ"
6. Set the Permission **Sites & Routes** to read-only
6. Select other permissions you want
7. Save the setting
8. Copy the token key
9. In the terminal, type: stencil init
10. Add the details
11. Paste the new token
12. You now can use all the stencil commands: stencil start
13. Here you might need to select a store if there are multiple stores. 

Milleruriol avatar Mar 15 '22 15:03 Milleruriol