Closed sideshowbarker closed 1 year ago
@sideshowbarker Which Node.js version are you using? You should be Node.js v16+, https://github.com/matrix-org/matrix-public-archive#prerequisites
@sideshowbarker Which Node.js version are you using? You should be Node.js v16+, matrix-org/matrix-public-archive#prerequisites
$ node --version
v19.1.0
Is that maybe too new? Should I try Node.js v16 or v17 instead?
OK, to answer my own question: I just now tried with Node.js v17.9.1 instead — and it works 🎉
But I guess that means there must be some difference in v19 which breaks this, so I guess I should leave this open?
It looks like require('crypto').webcrypto.subtle
is still available in Node.js v19 so it's not that.
Based on the line in the error stacktrace, it seems like it's complaining about us setting the global.crypto
. I guess Node.js v19 has crypto
set on the global
already.
I kinda see this change at https://nodejs.org/docs/latest-v19.x/api/webcrypto.html which mentions const { subtle } = globalThis.crypto;
.
We could add an extra check to only set it if vmContext.global.crypto
does not exist already. @sideshowbarker would be interested in submitting a PR (and a quick test)?
We could add an extra check to only set it if
vmContext.global.crypto
does not exist already. @sideshowbarker would be interested in submitting a PR (and a quick test)?
Yeah — I’ll take a shot at writing up a patch and test for it today
OK, https://github.com/matrix-org/matrix-public-archive/pull/143 now raised.
The test I added is just a shot in the dark. I’m happy to work on updating it further. As I understand it, the end-to-end test that’s needed here is something like “the room directory renders as expected“ — or maybe “the room directory renders without throwing“ — but I don’t yet understand how to write a granular test specifically for that.
After install, running
npm run start-dev
and then opening http://localhost:3050/ in my browser, I get this error: