Cache checks gives uncaught errors - but in one page only

Running this code:

Works fine in one page of my apps, but gives this error output in another:

Before If...
code.js:41 schemaFiles
code.js:2 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'replace')
    at Object.fn_3177f445c3270672da948e142ec2484d (code.js:2:20)
    at Object.fn_c798cac1ca8b24f5e8a180fe3a1b0a7a (code.js:9:91)
    at onContentAssignment (bundle.js:29:86)
    at run (sdk.js:16:229747)
    at sdk.js:16:230018
    at fk (sdk.js:16:985727)
    at W.unstable_runWithPriority (sdk.js:16:1018857)
    at gg (sdk.js:16:924903)
    at Oj (sdk.js:16:985182)
    at sdk.js:16:985093
fn_3177f445c3270672da948e142ec2484d @ code.js:2
fn_c798cac1ca8b24f5e8a180fe3a1b0a7a @ code.js:9
onContentAssignment @ bundle.js:29
run @ sdk.js:16
(anonymous) @ sdk.js:16
fk @ sdk.js:16
W.unstable_runWithPriority @ sdk.js:16
gg @ sdk.js:16
Oj @ sdk.js:16
(anonymous) @ sdk.js:16
V @ sdk.js:16
Pe.port1.onmessage @ sdk.js:16
Promise.then (async)
run @ sdk.js:16
(anonymous) @ sdk.js:16
fk @ sdk.js:16
W.unstable_runWithPriority @ sdk.js:16
gg @ sdk.js:16
Oj @ sdk.js:16
(anonymous) @ sdk.js:16
V @ sdk.js:16
Pe.port1.onmessage @ sdk.js:16
code.js:42 true
code.js:44 Inside If...
code.js:46 schema:
code.js:47 (11) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
code.js:48 Etter

The Uncaught error as I said appears in one page only, but that one returns fine:

Before If...
code.js:41 schemaFiles
code.js:42 true
code.js:44 Inside If...
code.js:46 schema:
code.js:47 (11) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
code.js:48 Etter

What am I doing wrong here?

Hello @Egil_Helland,

it’s hard to say something based on these log messages, for example, I see the line code.js:41 schemaFiles but don’t see this block on your screenshot. Also, the error seems to happen in a some custom function which is not on your screenshot too.

Yes, I found the cause after a lot of searching. Did not understand that the log lines were not linear. The problem was not the cache checks that it looked to be, but something completely different.

1 Like