codimd icon indicating copy to clipboard operation
codimd copied to clipboard

Bug: Docker Secrets lead to uncaughtException

Open DennisGaida opened this issue 4 months ago • 0 comments

As soon as you use docker secrets, you will get the following exception:

error:         uncaughtException: Cannot freeze array buffer views with elements                               15:29:21 [7/7167]TypeError: Cannot freeze array buffer views with elements                                                                                                    at Function.freeze (<anonymous>)                                                                                                                         at deepFreeze (/home/hackmd/app/node_modules/deep-freeze/index.js:2:10)                                                                                  at /home/hackmd/app/node_modules/deep-freeze/index.js:9:7                                                                                                at Array.forEach (<anonymous>)                                                                                                                           at deepFreeze (/home/hackmd/app/node_modules/deep-freeze/index.js:4:33)                                                                                  at /home/hackmd/app/node_modules/deep-freeze/index.js:9:7                                                                                                at Array.forEach (<anonymous>)
    at deepFreeze (/home/hackmd/app/node_modules/deep-freeze/index.js:4:33)
    at Object.<anonymous> (/home/hackmd/app/lib/config/index.js:214:10)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/home/hackmd/app/app.js:23:14)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)

If you use random secrets, that are not used by https://github.com/hackmdio/codimd/blob/develop/lib/config/dockerSecret.js, there is no exception. If you used a named secret (e.g. imgur_clientid), like in the following example, you get the exception.

  codimd:
    image: hackmdio/hackmd:2.6.1
    container_name: codimd
    [... other container settings ...]
    secrets:
      - source: codimd_imgur_secret
        target: imgur_clientid # when target = "abcef" no exception, but the secret is not used of course

DennisGaida avatar Oct 16 '25 13:10 DennisGaida