bigcommerce / stencil-cli

BigCommerce Stencil emulator for local theme development
https://developer.bigcommerce.com/stencil-docs
BSD 4-Clause "Original" or "Old" License
101 stars 141 forks source link

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

Open r742davis opened 3 years ago

r742davis commented 3 years ago

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.
db-ig commented 3 years ago

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

mrazzari commented 3 years ago

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.

Northwest-Website-Development commented 3 years ago

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

r742davis commented 3 years ago

@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/stencil-cli@3.1.1

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

Northwest-Website-Development commented 3 years ago

@r742davis -- can't thank you enough!

FrooAPinner commented 3 years ago

+1 Same issue on certain stores

tomdiggle commented 3 years ago

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

rs-ritu commented 3 years ago

@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???

brodsolutions commented 3 years ago

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?

royjulien commented 3 years ago

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.

You now can use all the stencil commands: stencil start

Good luck all!

CT-Talha commented 3 years ago

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.
Rajaotix commented 3 years ago

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

sanjay-makwana-avidbrio commented 3 years ago

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

Milleruriol commented 2 years ago

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.