[Bug]: hook (userconfig) failed to load! #525

Closed
opened 2026-02-04 20:11:12 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @halkeye on GitHub (Jun 12, 2024).

Where is the problem occurring?

None

What browsers are you seeing the problem on?

No response

Current behaviour

start.sh gives me

error: A hook (`userconfig`) failed to load!
error: Failed to lift app: Error: Attempted to `require('/app/config/custom.js')`, but an error occurred:
--
SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/app/config/custom.js:63:18)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:293:33
    at Array.forEach (<anonymous>)
    at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11)
    at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5)
    at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13)
    at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10)
    at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22)
    at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13)
--
    at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:298:25
    at Array.forEach (<anonymous>)
    at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11)
    at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5)
    at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13)
    at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10)
    at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22)
    at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13)
    at /app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1575:13
    at processQueue (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1585:13)
    at Object.auto (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1571:5)
    at Hook.loadUserConfig (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:160:13)
    at Hook.wrapper [as loadUserConfig] (/app/node_modules/.pnpm/@sailshq+lodash@3.10.6/node_modules/@sailshq/lodash/lib/index.js:3305:19)
    at Hook.loadModules (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/userconfig/index.js:45:21)
    at Hook.wrapper [as loadModules] (/app/node_modules/.pnpm/@sailshq+lodash@3.10.6/node_modules/@sailshq/lodash/lib/index.js:3305:19)
    at modules (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/index.js:86:25)
error: More details (raw): SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/app/config/custom.js:63:18)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:293:33
    at Array.forEach (<anonymous>)
    at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11)
    at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5)
    at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13)
    at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10)
    at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22)
    at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13)
``

### Desired behaviour

it not doing that :)

### Steps to reproduce

Straight up docker image
docker image: ghcr.io/plankanban/planka:1.18.0@sha256:34b420072ed7e3caacbd9363d26ffd2e20082a16336b44475b19de83a28df097

$ grep sdk /etc/mtab
/dev/sdk /app/public/user-avatars ext4 rw,relatime 0 0
/dev/sdk /app/private/attachments ext4 rw,relatime 0 0
/dev/sdk /app/public/project-background-images ext4 rw,relatime 0 0


### Other information

i can't figure out why planka/sails thinks config.js should be json
Originally created by @halkeye on GitHub (Jun 12, 2024). ### Where is the problem occurring? None ### What browsers are you seeing the problem on? _No response_ ### Current behaviour start.sh gives me ``` error: A hook (`userconfig`) failed to load! error: Failed to lift app: Error: Attempted to `require('/app/config/custom.js')`, but an error occurred: -- SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at Object.<anonymous> (/app/config/custom.js:63:18) at Module._compile (node:internal/modules/cjs/loader:1364:14) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:293:33 at Array.forEach (<anonymous>) at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11) at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5) at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13) at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10) at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22) at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13) -- at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:298:25 at Array.forEach (<anonymous>) at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11) at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5) at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13) at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10) at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22) at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13) at /app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1575:13 at processQueue (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1585:13) at Object.auto (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1571:5) at Hook.loadUserConfig (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:160:13) at Hook.wrapper [as loadUserConfig] (/app/node_modules/.pnpm/@sailshq+lodash@3.10.6/node_modules/@sailshq/lodash/lib/index.js:3305:19) at Hook.loadModules (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/userconfig/index.js:45:21) at Hook.wrapper [as loadModules] (/app/node_modules/.pnpm/@sailshq+lodash@3.10.6/node_modules/@sailshq/lodash/lib/index.js:3305:19) at modules (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/index.js:86:25) error: More details (raw): SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at Object.<anonymous> (/app/config/custom.js:63:18) at Module._compile (node:internal/modules/cjs/loader:1364:14) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at /app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:293:33 at Array.forEach (<anonymous>) at _recursivelyIncludeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:178:11) at includeAll (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-include-all-sync.js:317:5) at helpBuildDictionary (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/lib/help-build-dictionary.js:46:13) at module.exports.aggregate (/app/node_modules/.pnpm/include-all@4.0.3/node_modules/include-all/index.js:101:10) at loadOtherConfigFiles (/app/node_modules/.pnpm/sails@1.5.11/node_modules/sails/lib/hooks/moduleloader/index.js:162:22) at runTask (/app/node_modules/.pnpm/async@2.6.4/node_modules/async/dist/async.js:1637:13) `` ### Desired behaviour it not doing that :) ### Steps to reproduce Straight up docker image docker image: ghcr.io/plankanban/planka:1.18.0@sha256:34b420072ed7e3caacbd9363d26ffd2e20082a16336b44475b19de83a28df097 ``` $ grep sdk /etc/mtab /dev/sdk /app/public/user-avatars ext4 rw,relatime 0 0 /dev/sdk /app/private/attachments ext4 rw,relatime 0 0 /dev/sdk /app/public/project-background-images ext4 rw,relatime 0 0 ``` ### Other information i can't figure out why planka/sails thinks config.js should be json
OVERLORD added the bug label 2026-02-04 20:11:12 +03:00
Author
Owner

@halkeye commented on GitHub (Jun 12, 2024):

As I was writing this, I think i realized what was wrong

cat config/custom.js  | grep JSON
  webhooks: JSON.parse(process.env.WEBHOOKS), // TODO: validate structure

So webhooks needs a default? or some steps added to release notes

@halkeye commented on GitHub (Jun 12, 2024): As I was writing this, I think i realized what was wrong ``` cat config/custom.js | grep JSON webhooks: JSON.parse(process.env.WEBHOOKS), // TODO: validate structure ``` So webhooks needs a default? or some steps added to release notes
Author
Owner

@zezretro commented on GitHub (Jun 12, 2024):

I also experienced the same issue when my docker pulled the latest image this morning

I confirm my solution was to include and uncomment the new WEBHOOKS section of the docker-compose. I only updated the URL line. After re-running docker-compose plank now comes up again

@zezretro commented on GitHub (Jun 12, 2024): I also experienced the same issue when my docker pulled the latest image this morning I confirm my solution was to include and uncomment the new WEBHOOKS section of the docker-compose. I only updated the URL line. After re-running docker-compose plank now comes up again
Author
Owner

@jicho commented on GitHub (Jun 12, 2024):

Same problem here, solved it by adding this to compose (not sure it this a 100% correct "fix"):

     - |
        WEBHOOKS=[{
          "url": "http://localhost:1337",
          "accessToken": "notaccesstoken",
          "events": [],
          "excludedEvents": ["cardCreate", "cardUpdate", "cardDelete", "notificationCreate", "notificationUpdate"]
        }]

Thing is that I don't want to use web hooks at the moment, so I expected that I didn't need to add it based on the compose example.

@jicho commented on GitHub (Jun 12, 2024): Same problem here, solved it by adding this to compose (not sure it this a 100% correct "fix"): ``` - | WEBHOOKS=[{ "url": "http://localhost:1337", "accessToken": "notaccesstoken", "events": [], "excludedEvents": ["cardCreate", "cardUpdate", "cardDelete", "notificationCreate", "notificationUpdate"] }] ``` Thing is that I don't want to use web hooks at the moment, so I expected that I didn't need to add it based on the compose example.
Author
Owner

@halkeye commented on GitHub (Jun 12, 2024):

I would set the WEBHOOKS value to "[]" if you don't need them
I submitted a PR to add a default of empty

@halkeye commented on GitHub (Jun 12, 2024): I would set the WEBHOOKS value to "[]" if you don't need them I submitted a PR to add a default of empty
Author
Owner

@jicho commented on GitHub (Jun 12, 2024):

@halkeye you're right, that works. For some reason it didn't work when I tried it initially, that's why I ended up with my previous reaction... Probably did something wrong :(

Thank you for your reaction!

@jicho commented on GitHub (Jun 12, 2024): @halkeye you're right, that works. For some reason it didn't work when I tried it initially, that's why I ended up with my previous reaction... Probably did something wrong :( Thank you for your reaction!
Author
Owner

@meltyshev commented on GitHub (Jun 12, 2024):

Thanks for reporting and fixing this so quickly :)
The fixed version is being built, and you can remove/comment the WEBHOOKS environment variable if you don't use it.

@meltyshev commented on GitHub (Jun 12, 2024): Thanks for reporting and fixing this so quickly :) The fixed version is being built, and you can remove/comment the `WEBHOOKS` environment variable if you don't use it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#525