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

Uncaught TypeError: this._evictHandle.unref is not a function #638

Open
sagar86kc opened this issue Jun 5, 2019 · 8 comments

Comments

Projects
None yet
4 participants
@sagar86kc
Copy link

commented Jun 5, 2019

I am trying Electron (v5.0.2) for a desktop application with cloud spanner database but it fails with below error:

Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v5.0-win32-x64-unknown
Found: [node-v64-win32-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module 'C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\node\extension_binary\electron-v5.0-win32-x64-unknown\grpc_node.node'

npm rebuild did not fix the error and I changed the grpc from nodejs node to electron node with below command and got the different error:
npm install grpc --runtime=electron --target=5.0.2

Uncaught TypeError: this._evictHandle.unref is not a function
at SessionPool._startHouseKeeping (C:\Users\newadminuser\Desktop\app\node_modules@google-cloud\spanner\build\src\session-pool.js:628)
at SessionPool.open (C:\Users\newadminuser\Desktop\app\node_modules@google-cloud\spanner\build\src\session-pool.js:225)
at new Database (C:\Users\newadminuser\Desktop\app\node_modules@google-cloud\spanner\build\src\database.js:118)
at Instance.database (C:\Users\newadminuser\Desktop\app\node_modules@google-cloud\spanner\build\src\instance.js:251)
at getData (spanner.js:38)
at HTMLInputElement. (spanner.js:8)

@callmehiphop

This comment has been minimized.

Copy link
Member

commented Jun 5, 2019

This is interesting, looks like electron uses the browser version of setTimeout/setInterval. Should be a simple fix, we just need to check if unref() is available before calling it.

@sagar86kc

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

After fixing the unref() error, it fails with multiple errors:

spanner.js:45 An error ocurred performing the query.
spanner.js:46 Error: Database is closed.
C:\Users\newadminuser\Desktop\app\node_modules\grpc-gcp\build\src\index.js:208 Cannot find affinity value from proto message using affinity_key: name.
Uncaught (in promise) Error: 3 INVALID_ARGUMENT: Invalid DeleteSession request.
at Object.exports.createStatusError (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\common.js:91)
at Object.onReceiveStatus (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:1204)
at InterceptingListener._callNext (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:568)
at InterceptingListener.onReceiveStatus (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:618)
at Object.onReceiveStatus (C:\Users\newadminuser\Desktop\app\node_modules\grpc-gcp\build\src\index.js:93)
at InterceptingListener._callNext (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:568)
at InterceptingListener.onReceiveStatus (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:618)
at callback (C:\Users\newadminuser\Desktop\app\node_modules\grpc\src\client_interceptors.js:845)

@sagar86kc

This comment has been minimized.

Copy link
Author

commented Jun 6, 2019

I am just fetching data through simple select query from a table with service account login. Has anyone tried spanner database in electron framework?

@laljikanjareeya

This comment has been minimized.

Copy link

commented Jun 10, 2019

Looks like Electron has a different binary interface.

I tried using below command given on this link

npm rebuild --runtime=electron --target=5.0.2

I have integrated @google-cloud/spanner in electron-quick-start and it's working.

@bcoe

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

@sagar86kc mind confirming whether @lakshminpallikila's approach works for you, when you have two seconds?

@sagar86kc

This comment has been minimized.

Copy link
Author

commented Jun 12, 2019

@laljikanjareeya I did install gRPC for electron and then the first error was with unref() which I changed per @callmehiphop comment.
Later there were many errors which include closed connection as in previous comment.

@bcoe , yes and this did not fix the error for me. I am running simple app as shown in electron get started guide with spanner db connection and get the data from a table per spanner nodejs documentation example.

@laljikanjareeya

This comment has been minimized.

Copy link

commented Jun 12, 2019

please refer working demo here

If you get error after npm start, than rebuild it with above command.

@laljikanjareeya

This comment has been minimized.

Copy link

commented Jun 18, 2019

@sagar86kc Where you able to solve your issue using the demo linked above? If not, then please share your code snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.