-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
The code in question is here
etherpad-lite/src/node/hooks/express/specialpages.ts
Lines 104 to 129 in 8ded04a
| const convertTypescript = (content: string) => { | |
| const outputRaw = buildSync({ | |
| stdin: { | |
| contents: content, | |
| resolveDir: path.join(settings.root, 'var','js'), | |
| loader: 'js' | |
| }, | |
| alias:{ | |
| "ep_etherpad-lite/static/js/browser": 'ep_etherpad-lite/static/js/vendors/browser', | |
| "ep_etherpad-lite/static/js/nice-select": 'ep_etherpad-lite/static/js/vendors/nice-select' | |
| }, | |
| bundle: true, // Bundle the files together | |
| minify: process.env.NODE_ENV === "production", // Minify the output | |
| sourcemap: !(process.env.NODE_ENV === "production"), // Generate source maps | |
| sourceRoot: settings.root+"/src/static/js/", | |
| target: ['es2020'], // Target ECMAScript version | |
| metafile: true, | |
| write: false, // Do not write to file system, | |
| }) | |
| const output = outputRaw.outputFiles[0].text | |
| return { | |
| output, | |
| hash: outputRaw.outputFiles[0].hash.replaceAll('/','2').replaceAll("+",'5').replaceAll("^","7") | |
| } | |
| } |
every time an etherpad deployment starts it generates new hashes for the same files although their content hasn't changed
imagine the following environment
ingress -> etherpad service -> multiple etherpad pods
you are using socket.io under the hood which is versatile however the plain js code is kinda bound to one pod since each pod will have their own hashes.
so if one pod serves some html references its js with its own hashes but next request goes to a pod which has other hashes this results in a 404
To Reproduce
Steps to reproduce the behavior:
- start with prod and put a breakpoint here
const padSliderWrite = convertTypescript(padString) - see whats hashed
- restart
- compare new hash
Expected behavior
hashes are stable
Server (please complete the following information):
- Etherpad version: 2.5.2
Additional context
this makes it very hard to run multiple etherpad pods at once even though socket.io already provides a nice basis