Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stencil push fails with error "worker initialization failed" #1236

Open
pvaladez opened this issue Oct 30, 2024 · 17 comments
Open

stencil push fails with error "worker initialization failed" #1236

pvaladez opened this issue Oct 30, 2024 · 17 comments

Comments

@pvaladez
Copy link

pvaladez commented Oct 30, 2024

Expected behavior

stencil push works. Or an easier to see and more informative error is shown.

Actual behavior

stencil push fails with the error worker initialization failed.

Steps to reproduce behavior

Using stencil-cli version 8.4.0, as soon as you run stencil start it renames stencil.conf.js to stencil.conf.cjs. Afterward, if someone else using an older stencil-cli version like 7.5.5 then stencil push fails with a very subtle error that just says worker initialization failed.

image

I realize that this could be avoided by just making sure that everyone is using the latest version, but some of us developers are a paranoid folk who often try not to update things unless we have to. Additionally, it might not be obvious what caused this failure to happen.

Could we do something to handle this situation better? Perhaps:

  1. Leave stencil.conf.js in place, and just make a copy with the .cjs file extension
  2. Don't rename it to .cjs extension... I figure this is done because of the recent move to esm, but is it necessary?
  3. Create a field somewhere that indicates what version of stencil-cli should be compatible with the theme code. You could perhaps use this information to provide a better error in the future.
    a. On that note, the current version of cornerstone doesn't use the .cjs extension.

Also, I realize I'm getting a bit picky in asking for the above, but I figure it couldn't hurt to maybe consider it. Also, half the reason for writing this is for anyone else that may encounter the problem and not realize what's going on.

Environment

Stencil-cli version stencil --version:
8.4.4 / 7.5.5
Node version node -v:
18.19
NPM version npm -v:
10.2.3
OS:
macOS

@stefanmiodrag
Copy link

I'm getting this error too, however my config is named config.stencil.json after it's generated.

@travisfisher-pdi
Copy link

Having the same issue. @stefanmiodrag @pvaladez were you able to fix it and if so, how?

@pvaladez
Copy link
Author

@stefanmiodrag config.stencil.json is a different file and not related to this issue.

@travisfisher-pdi you can either update to the latest stencil-cli version, or make a copy of stencil.conf.cjs and rename it to the original filename stencil.conf.js.

@ldias2025
Copy link

@travisfisher-pdi Has anybody figured this out? I am also receiving this error. I just installed the latest version of stencil cli. also my file is config.stencil.json @pvaladez

@travisfisher-pdi
Copy link

@ldias2025 @stefanmiodrag I joined the BigCommerce Developers Slack channel and did a search and everyone's feedback on the issue was to upgrade your theme version (in our case, this was the Capacity theme). I diffed the new version of the theme against our older version and brought over our customizations to the newest version (in this case, 5.0.0) and that solved the issue. I do recommend joining that Slack group if you have not done so yet. A lot of good activity there.

@ldias2025
Copy link

@travisfisher-pdi thank you for the response. That is unfortunate. There is so much custom code and changes to the website I would be terrified to update it and try to see what all needs brought over.

@justsilencia
Copy link

justsilencia commented Jan 19, 2025

I deleted my original complaining session to update that I was able to come up with a solution. I now realize if I would have looked at the OP a little closer, I would have resolved this much sooner. The issue was simply that stencil.conf.cjs is being renamed and/or deleted from the project at some point. Once I replace this file, everything builds as expected.

@ldias2025
Copy link

I deleted my original complaining session to update that I was able to come up with a solution. I now realize if I would have looked at the OP a little closer, I would have resolved this much sooner. The issue was simply that stencil.conf.cjs is being renamed and/or deleted from the project at some point. Once I replace this file, everything builds as expected.

Are you on cornerstone theme? Where did you find the stencil.conf.cjs or stencil.conf.js file, because I cant find this anywhere. All I see is my config.stencil.json

@ldias2025
Copy link

I deleted my original complaining session to update that I was able to come up with a solution. I now realize if I would have looked at the OP a little closer, I would have resolved this much sooner. The issue was simply that stencil.conf.cjs is being renamed and/or deleted from the project at some point. Once I replace this file, everything builds as expected.

Are you on cornerstone theme? Where did you find the stencil.conf.cjs or stencil.conf.js file, because I cant find this anywhere. All I see is my config.stencil.json

@justsilencia So I looked at one of my old themes and I found the stenicl.conf.js was completely missing from my current theme , I added it back in. I am hoping this solves the problem.

@Code-and-Spade
Copy link

@ldias2025 I am having the same issue. Glad to see there are others in my boat! Can you please advise where the stencil.conf.js should be and what it should contain? Thank you

@ldias2025
Copy link

@ldias2025 I am having the same issue. Glad to see there are others in my boat! Can you please advise where the stencil.conf.js should be and what it should contain? Thank you

Its always nice to hear that others are experiencing the same thing and its not just me being dumb! Haha.

So the theme I was trying to push and rendered the worker initialization error did not have the stencil.conf.js file in it at all. I am not sure why. But it needs to just go in the root directory - so the same spot as other files like secrets.stencil.json, schema.json, config.json, etc. And actually when I added the stencil.conf.js ONLY and tried to do stencil start... stencil wouldnt even start. Now that I have added the stencil.conf.cjs it will load stencil AND push through. I actually have both files sitting in my root directory at the moment.

As far as what it contains I am not sure. You should be able to snag it from the original theme and just place it in the root directory of the theme you are wanting to work on and push to the site.

I hope this helps!

@serchrobles
Copy link

I just copied this file for my cornerstone theme and the stencil bundle worked!

@ldias2025
Copy link

I just copied this file for my cornerstone theme and the stencil bundle worked!

Same! So happy! I hate when my Stencil messes up. Its always such a pain to figure out. Haha

@Code-and-Spade
Copy link

@ldias2025 @serchrobles Thank you to all for your help - this did it! I can't believe it was so simple.
I did get this warning, though. Can anyone weigh in on where it's coming from?

`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
    at isModuleDeclaration (/Users/cas/Downloads/Cornerstone-6.16.0/node_modules/@babel/types/lib/validators/generated/index.js:2755:35)
    at PluginPass.Program (/Users/cas/Downloads/Cornerstone-6.16.0/node_modules/babel-plugin-lodash/lib/index.js:102:44)

@ldias2025
Copy link

@ldias2025 @serchrobles Thank you to all for your help - this did it! I can't believe it was so simple. I did get this warning, though. Can anyone weigh in on where it's coming from?

`isModuleDeclaration` has been deprecated, please migrate to `isImportOrExportDeclaration`
    at isModuleDeclaration (/Users/cas/Downloads/Cornerstone-6.16.0/node_modules/@babel/types/lib/validators/generated/index.js:2755:35)
    at PluginPass.Program (/Users/cas/Downloads/Cornerstone-6.16.0/node_modules/babel-plugin-lodash/lib/index.js:102:44)

This I am not sure of. I didnt even notice I have that too until you brought it up, but everything seems to be functioning okay so I am rolling with it at the moment.

@GauravI95Dev
Copy link

GauravI95Dev commented Feb 10, 2025

I just copied this file for my cornerstone theme and the stencil bundle worked!

Great this worked for me.

@roodindustries
Copy link

I came across this problem this morning. Here is what happens:

  • Started with fresh copy of Cornerstone 6.15.0 theme a few months back, implemented our customizations, bundled, pushed, good to go (this fresh copy, included stencil.conf.js)
  • Today, had a make a quick change. On a "new" computer, did a "stencil download". Made my changes, did a "stencil bundle", and "working initialization failed" error.

TLDR: when you do a "stencil download" of your current theme into a "new" local directory, stencil.conf.js is NOT included. Downloaded one from the base cornerstone theme github account. dropped in folder and viola, good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants