-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Error: failed to init the steamworks API #111
Comments
There's an example test electron project checked into this repository, in the The easiest way to test it is to copy the entire (Note that you do have to launch the Steam client app yourself manually before launching the Electron app; the Steamworks API is designed to communicate with the Steam client app process to do its work.) On my macOS Ventura 13.4.1 machine, the test Electron app launches without error and displays my Steam user name in the UI of the Electron app. Note what I didn't have to do: I didn't have to include my own copy of the If the example works for you, you should be able to make small changes to the project, e.g. change If it doesn't work for you, you could try building |
Hi @dfabulich, I'm @chostett's collaborator -- thanks for pointing us in the right direction ! I was able to run the example project successfully, and include my own App ID. Another big step forward is that I was able to successfully initialize steamworks.js in our project, but only when running in development mode. Unfortunately the error persists in the production build. Made note of some notable differences in our project compared to the example, perhaps one of these is to blame:
I currently suspect the issue lies with electron-builder. I'll try to keep this thread up-to-date in case anyone else is experiencing the same issue. |
Update: ran some experiments, and yep... it looks like an electron-builder issue. I could successfully build and run the example after moving the init to the main process, and after downgrading electron. On the other hand, the example crashes when I build it using electron-builder. Minimal repro -- use the code in the example directory, change the package.json to this:
Result is that the application crashes with a segfault immediately on launch, then OS X pops up an error-reporting modal "steamworks.js-electron-test quit unexpectedly." |
Why are you initializing steamworks from the main process? Steamworks wants access to the UI, so initializing in the renderer is probably best, following the example project. |
@dfabulich - my project is using "contextIsolation" from the browser window, so I handle the calls to steamworks using IPC. I wanted to check to find out whether that makes a difference (in terms of whether or not the application crashes). Turns out it doesn't. Whether steamworks is called from "main" or from "renderer" -- either way, the example crashes if I build it with electron-builder instead of electron-packager. |
I use
I just tried it with |
I still haven't found a compatible combination of versions and invocations. The latest thing I've tried is:
Using the code from the example app. Build with this command:
The resulting |
Does it render HTML when you rip out Steamworks? |
If I remove steamworks completely then yes, the application renders as expected. There are two points in the example code that call
I ran a couple other experiments. Here were the results I got:
I suspect the issue lies in the |
Are you calling |
No, I never call it on load. It's called in the button event handler |
Summary/status-update: I can get steamworks.js to run correctly in development mode in my own project, but not when building it into a ".app" package. I can get steamworks.js to build and run as a ".app" using the example project. The primary difference seems to be the way the projects are built. I did some tests to try to build the example project using other build tools. I was unsuccessful.
I don't particularly want to migrate my project to use electron-packager, but I'm not seeing a lot of other options at the moment. 1 In addition to my own tests, I found an issue about it in the electron forge repo -- electron/forge#3193 |
One of the hardest things about Your When I check out that branch, build steamworks.js, and Does my If you'd like to make a similar PR for |
@dfabulich - thank you for the reproducible example! Unfortunately, the problem persists. Here are the steps I followed.
First attempt
Second attempt
|
UPDATE: Third attempt: explicitly disable code-signing in electron-builder
By default, electron-builder was code-signing using my keychain. From https://www.electron.build/code-signing.html
This feels like huge progress, but still leaves the open question: "How do I use steamworks.js if I want to ship a signed, notarized mac app?" |
@mkaemmerer can you check if the error still persists on latest version? |
electron-builder --mac -c.mac.identity=null this one works for me, but it shows error after uploaded to steam |
Hi there! We're (my co-dev and I) are currently using your library for our game, built in Electron and we're having issues connecting to Steamworks API. The error message we're getting is "Error: failed to init the steamworks API."
We've tried:
This might be related to this issue:
#65
We've read the Steamworks documentation and made sure that the “.dylib” file is present, and the “steam_appid.txt” is included.
I don't know what else to try. Could you help us?
The text was updated successfully, but these errors were encountered: