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

Unable to initialize msnodesql during Hot Module Reload (HMR) #315

Open
CarlosOnline opened this issue Dec 4, 2023 · 2 comments
Open

Unable to initialize msnodesql during Hot Module Reload (HMR) #315

CarlosOnline opened this issue Dec 4, 2023 · 2 comments

Comments

@CarlosOnline
Copy link

Looking for help on resolving Unable to initialize msnodesql error during HMR, using vite for electron.

Source:
const msnodesqlv8 = require("mssql/msnodesqlv8");

Is there any reset or connection code I can apply to cause msnodesqlv8 to reload during HMR?

	void Connection::Init(Local<Object> exports) {
  		Nan::HandleScope scope;
		const auto initialized = OdbcConnection::InitializeEnvironment();
		const auto name = Nan::New("Connection").ToLocalChecked();
		if (!initialized) {
			const nodeTypeFactory fact;
			MutateJS::set_property_value(exports, name, Nan::Null());
			fact.throwError("Unable to initialize msnodesql");
			return;
		}
@TimelordUK
Copy link
Owner

Im sorry I am not aware how this can be solved. Can you try storing require on global and fetch back cached version is it related to second call to initialise. Ideally can you inject the same instance in every time. I’m really not an expert of the front end side of things.

@MikeNitsenko
Copy link

@CarlosOnline did you find any solution for this? Please share of you have ideas =)

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

3 participants