-
Notifications
You must be signed in to change notification settings - Fork 49
JavaScriptEngineSwitcher crashes in a dockerized .NET Core application #27
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
Comments
Hello, Björn!
As far as I know, that this option is not used in ReactJS.NET version 3.X. The same error ( |
Hello Taritsyn, and thank you for the quick response! I saw that thread when googling for a solution, but I'm not sure that it applies to my situation? The thing I think is weird, is that I can run the application without any problems on a fresh installation of Ubuntu - without Chrome or V8 installed on the system. Nodejs is however installed on that Ubuntu machine, so maybe libVroomJs is available through nodejs in that case? |
In your case, need to build the native assemblies of VroomJs - https://github.com/pauldotknopf/vroomjs-core#maclinux. But as far as I am aware, that this build script is not working. I recommend you to read the “VroomJsInitialisationException: Failed to initialise VroomJs” discussion. |
ReactJS.NET iterates through all the engine factories and uses the first working one (see https://github.com/reactjs/React.NET/blob/master/src/React.Core/JavaScriptEngineFactory.cs#L254), so you just need to register your preferred engine first. It could be modified to use Note that ReactJS.NET has a default engine configuration (see https://github.com/reactjs/React.NET/blob/master/src/React.Core/JavaScriptEngineFactory.cs#L358-L384) that's used if you don't configure JavaScriptEngineSwitcher yourself. If you do configure JavaScriptEngineSwitcher, your config will override ReactJS.NET's one. So just call |
I'm pre-rendering some javascript server side in a current project, using ReactJS.NET which in turn relies heavily on JavaScriptEngineSwitcher.
Running the project from a host OS, I have no problems what so ever. I'm using ChakraCore as the engine to pre-render my React components, and I have NuGet references for the following dependencies:
Running the project with
dotnet run
succeeds in Windows, Mac OS X and Ubuntu/Debian. Publishing the application and running it from the publish directory succeeds in all operating systems as well (usingdotnet publish -c Release -o <MYPATH> && cd <MYPATH> && dotnet <DLLFILE>
).However, when creating a Docker container from my published files and running the application from a container (using base image
microsoft/aspnetcore:1.1.1
) I get the following exception (runtime, on first page load):It seems like ChakraCore isn't registered as my default engine, or .NET Core can't find the library file? I register ChakraCore as my default javascript engine using;
I've even tried using a ChakraCore binary (
libChakraCore.so
) compiled in my Docker image, but without success. Is there anything I'm missing, or is it something I'm missing in my setup?I realize the problem might lie in ReactJS.NET as well - but since the main problem seems to be that the default engine isn't initialized I'm guessing it has something to do with JavaScriptEngineSwitcher.
The text was updated successfully, but these errors were encountered: