[GH-ISSUE #1000] The BROWSER_WEB_URL url validation is overly strict when running db migrations #663

Closed
opened 2026-03-02 11:51:44 +03:00 by kerem · 1 comment
Owner

Originally created by @fschoell on GitHub (Feb 9, 2025).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1000

Describe the Bug

Passing http://chrome.web.1:9222 as the BROWSER_WEB_URL environment variable results in an Invalid url error from the db migrations, although it's a valid Docker address (this is the default naming scheme when deploying with dokku which afaik you can not change).

Steps to Reproduce

Start the hoarder container with BROWSER_WEB_URL set to http://chrome.web.1:9222 will result in this error:

=====> Start of hoarder container output (d35b28fdd24b web.1)
       s6-rc: info: service s6rc-oneshot-runner: starting
       s6-rc: info: service s6rc-oneshot-runner successfully started
       s6-rc: info: service fix-attrs: starting
       s6-rc: info: service init-db-migration: starting
       s6-rc: info: service fix-attrs successfully started
       s6-rc: info: service legacy-cont-init: starting
       Running db migration script
       s6-rc: info: service legacy-cont-init successfully started
       /db_migrations/index.js:8277
               throw result.error;
               ^
       ZodError: [
         {
           "validation": "url",
           "code": "invalid_string",
           "message": "Invalid url",
           "path": [
             "BROWSER_WEB_URL"
           ]
         }
       ]
           at get error (/db_migrations/index.js:8177:31)
           at ZodEffects.parse (/db_migrations/index.js:8277:22)
           at /db_migrations/index.js:12420:41
           at /db_migrations/index.js:12520:3
           at Object.<anonymous> (/db_migrations/index.js:12523:12)
           at Module._compile (node:internal/modules/cjs/loader:1562:14)
           at Object..js (node:internal/modules/cjs/loader:1699:10)
           at Module.load (node:internal/modules/cjs/loader:1313:32)
           at Function._load (node:internal/modules/cjs/loader:1123:12)
           at TracingChannel.traceSync (node:diagnostics_channel:322:14) {
         issues: [
           {
             validation: 'url',
             code: 'invalid_string',
             message: 'Invalid url',
             path: [ 'BROWSER_WEB_URL' ]
           }
         ],
         addIssue: [Function (anonymous)],
         addIssues: [Function (anonymous)],
         errors: [
           {
             validation: 'url',
             code: 'invalid_string',
             message: 'Invalid url',
             path: [ 'BROWSER_WEB_URL' ]
           }
         ]
       }
       Node.js v22.13.1
       s6-rc: warning: unable to start service init-db-migration: command exited 1

Expected Behaviour

Accept http://chrome.web.1:9222 as the browser url

Screenshots or Additional Context

No response

Device Details

No response

Exact Hoarder Version

v0.22.0

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem
Originally created by @fschoell on GitHub (Feb 9, 2025). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1000 ### Describe the Bug Passing `http://chrome.web.1:9222` as the `BROWSER_WEB_URL` environment variable results in an _Invalid url_ error from the db migrations, although it's a valid Docker address (this is the default naming scheme when deploying with dokku which afaik you can not change). ### Steps to Reproduce Start the hoarder container with `BROWSER_WEB_URL` set to `http://chrome.web.1:9222` will result in this error: ``` =====> Start of hoarder container output (d35b28fdd24b web.1) s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service init-db-migration: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting Running db migration script s6-rc: info: service legacy-cont-init successfully started /db_migrations/index.js:8277 throw result.error; ^ ZodError: [ { "validation": "url", "code": "invalid_string", "message": "Invalid url", "path": [ "BROWSER_WEB_URL" ] } ] at get error (/db_migrations/index.js:8177:31) at ZodEffects.parse (/db_migrations/index.js:8277:22) at /db_migrations/index.js:12420:41 at /db_migrations/index.js:12520:3 at Object.<anonymous> (/db_migrations/index.js:12523:12) at Module._compile (node:internal/modules/cjs/loader:1562:14) at Object..js (node:internal/modules/cjs/loader:1699:10) at Module.load (node:internal/modules/cjs/loader:1313:32) at Function._load (node:internal/modules/cjs/loader:1123:12) at TracingChannel.traceSync (node:diagnostics_channel:322:14) { issues: [ { validation: 'url', code: 'invalid_string', message: 'Invalid url', path: [ 'BROWSER_WEB_URL' ] } ], addIssue: [Function (anonymous)], addIssues: [Function (anonymous)], errors: [ { validation: 'url', code: 'invalid_string', message: 'Invalid url', path: [ 'BROWSER_WEB_URL' ] } ] } Node.js v22.13.1 s6-rc: warning: unable to start service init-db-migration: command exited 1 ``` ### Expected Behaviour Accept `http://chrome.web.1:9222` as the browser url ### Screenshots or Additional Context _No response_ ### Device Details _No response_ ### Exact Hoarder Version v0.22.0 ### Have you checked the troubleshooting guide? - [x] I have checked the troubleshooting guide and I haven't found a solution to my problem
kerem 2026-03-02 11:51:44 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@MohamedBassem commented on GitHub (Feb 9, 2025):

That should be easy to fix by dropping the url validation from (https://github.com/hoarder-app/hoarder/blob/main/packages/shared/config.ts#L36-L37)

<!-- gh-comment-id:2646300300 --> @MohamedBassem commented on GitHub (Feb 9, 2025): That should be easy to fix by dropping the `url` validation from (https://github.com/hoarder-app/hoarder/blob/main/packages/shared/config.ts#L36-L37)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#663
No description provided.