stencil-cli
stencil-cli copied to clipboard
No API host found in config file
No api host found in config file, falling back to https://api.bigcommerce.com/. You may need to run 'stencil init' again.
Looks very similar to https://github.com/bigcommerce/stencil-cli/issues/844
Running stencil init -h https://api.bigcommerce.com/
solved for me.
Expected behavior
Stencil start throws no errors
Actual behavior
After running Stencil Start we receive a message of:
No api host found in config file, falling back to https://api.bigcommerce.com/. You may need to run 'stencil init' again.
Running Stencil init again does not resolve the issue
Steps to reproduce behavior
Environment
Stencil-cli version stencil --version
: 6.0.0
Node version node -v
: 14.20.0
NPM version npm -v
:6.14.17
OS: MacS Monterey version 12.6
Hi @BC-AdamWard, do yo mind to provide screenshots for the errors you had?
Hey Jairo,
Error on Stencil Start
-
It does still launch but after that it seems some updates to the theme files do not get reflected in Browsersync appropriately.
The error also pops up on stencil push
, but the file seems to be pushed correctly
Running stencil init
also receives the error.
However, even though Stencil Init says it is adding the host, it is not saved in my config.stencil.json file unless I explicitely run stencil init -h https://api.bigcommerce.com
Let me know if I can help with anything else. The biggest issue was not seeing changes reflected on localhost.
Hi @BC-AdamWard, I don't see any errors, on the screenshots you provided. 'No Api host' message is just a warning to be aware of what is in your config
I've had exactly the same issue as @BC-AdamWard. Am In the middle of doing a manual upgrade to Cornerstone 6.7 (from 1.3, don't ask), tried doing a test with a fresh install, get to the exact same point. Here's the error that it throws back:
not ok -- StoreSettingsLocaleError: Request failed with status code 403
URL: https://api.bigcommerce.com/stores/9x14icgu4u/v3/settings/store/locale
Method: GET
Incidentally, tried using @BC-AdamWard's approach and firing stencil init -h https://api.bigcommerce.com/
but that would just throw back this error:
not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 404
Been using Stencil/Cornerstone for my custom Bigcommerce page for a few years now, also the first time I've noticed this after I run stencil init
:
Set API host to: https://api.bigcommerce.com/
You are now ready to go! To start developing, run $ stencil start
I've never seen it ask for the API host to be set, is that new, would that normally print out?
Just to quickly update, I just tried running stencil start
, just to see what would happen, haven't done anything or made any changes at all, haven't touched a single thing since the last post (given it's been NYE and all), and now Stencil miraculously starts up, but still with a No api host found
warning injected in the first line.
So I can get past the API error for now it seems, but once I've booted Stencil up it looks like I have no dist folder generating. Great. I swear, just getting this environment up and running has been the biggest pain in the ass.
I encountered this also, and was able to resolve it by recreating the API account. That is, as the site owner: Settings -> Api Accounts -> Create new Api Account Then create one using of type "Stencil CLI account".
Using the resulting values, rerun stencil init, e.g.: stencil init --url https://yourdomainy.com --token yourtoken
More info: I ran into this when trying to run stencil start
locally on Windows 10. Our BigCommerce theme hadn't been updated for about a year.
Hello, have you solved this problem? I also had this problem and recreated the token, which was also not resolved.
Hello, have you solved this problem? I also had this problem and recreated the token, which was also not resolved.
Yes, I recreated the API account and then re-ran stencil init
. That's all I know. :|
-
But I recreated the token and it didn't work.(crying)
This is what I had to do. I think there's a scope issue with Stencil CLI tokens. When you're creating a new token, create a V2/V3 API token with the following scopes set:
- Information & settings: modify
- Themes: modify
- Sites & routes: read-only
I was able to resolve the "No Api host" issue with the following command stencil init -h https://api.bigcommerce.com
it added "apiHost": "https://api.bigcommerce.com" to the config.stencil.json
{
"customLayouts": {
"brand": {},
"category": {},
"page": {},
"product": {}
},
"normalStoreUrl": "https://[YOUR_STORE_URL].mybigcommerce.com/",
"port": 3000,
"apiHost": "https://api.bigcommerce.com"
}