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

Cannot read properties of undefined (reading 'maxLength') #225

Open
alexgleason opened this issue Apr 29, 2023 · 3 comments
Open

Cannot read properties of undefined (reading 'maxLength') #225

alexgleason opened this issue Apr 29, 2023 · 3 comments

Comments

@alexgleason
Copy link

This issue happens during local development with Deno.

Hot reloading is enabled. When a file is changed, the program stops working until I manually kill and restart the server:

Watcher File change detected! Restarting!
error: Uncaught TypeError: Cannot read properties of undefined (reading 'maxLength')
    at file:///home/alex/.cache/deno/npm/registry.npmjs.org/lmdb/2.7.11/read.js:8:20
Watcher Process finished. Restarting on file change...

https://github.com/kriszyp/lmdb-js/blob/master/read.js#L8

@kriszyp
Copy link
Owner

kriszyp commented May 1, 2023

How do you do hot reloading in Deno? I suspect that hot reloading is possibly not reloading the NAPI module or getting the reference incorrectly, but not sure how to reproduce.

@alexgleason
Copy link
Author

Use deno run --watch myfile.ts

Simply open a database in this app, add a comment or something and save.

@kriszyp
Copy link
Owner

kriszyp commented May 1, 2023

Ok, thank you. I believe this actually appears to be a bug in Deno. lmdb-js uses two the NAPI modules (one for lmdb and one for msgpackr) and it is returning the wrong one after reloading (it is probably caching a single/last NAPI module). We should probably come up with a more isolated test case to submit to Deno. In the meantime you can set this env variable to disable the msgpackr NAPI module MSGPACKR_NATIVE_ACCELERATION_DISABLED=true.

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

2 participants