Error while processing route: posts.index Invalid value used as weak map key

#1

Hi,

Can anyone help with the error below showing in browser console when visiting /ghost/#/posts admin panel show a ‘500’ page.

I can’t see any errors on server.

Thanks
Stewart

vendor.min-0263b678a709a576c1af220f02dd58fc.js:2185 Error while processing route: posts.index Invalid value used as weak map key TypeError: Invalid value used as weak map key
    at WeakMap.set (<anonymous>)
    at u (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1561:19)
    at d (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1567:8)
    at A (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1606:96)
    at le (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1683:8)
    at e.addArrayObserver (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1573:116)
    at r.o._addArrangedContentArrayObsever (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:2414:27)
at r.o.(anonymous function) [as __PROPERTY_DID_CHANGE__ember15554105084371442417960560__] (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:2413:136    )
    at C (https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1636:52)
    at https://www.**************.com/ghost/assets/vendor.min-0263b678a709a576c1af220f02dd58fc.js:1633:135
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2185
error @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2185
_ @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2195
p.triggerEvent @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2127
t.trigger @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4363
p.transitionDidError @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2127
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4354
z @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4557
_ @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4567
W @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4565
g @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4563
t.invoke @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4098
t.flush @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4090
t.flush @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4103
r._end @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4165
r.end @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4120
r._run @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4166
r._join @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4165
r.join @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4131
d @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2981
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:7265
c @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:558
fireWith @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:559
W @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:831
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:841
load (async)
send @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:841
ajax @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:819
_makeRequest @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:7262
_makeRequest @ ghost.min-0ef8daed89a0ee272daf356b10b9de5f.js:1456
r @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2518
request @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:7256
ajax @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:7302
query @ ghost.min-0ef8daed89a0ee272daf356b10b9de5f.js:6
query @ ghost.min-0ef8daed89a0ee272daf356b10b9de5f.js:11
r @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2518
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:8417
z @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4557
_ @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4567
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4575
t.invoke @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4098
t.flush @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4090
t.flush @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4103
r._end @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4165
r.end @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4120
r._run @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4166
r._join @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4165
r.join @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:4131
d @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2981
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2682
a @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2906
handleEvent @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2682
handleEvent @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2591
(anonymous) @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:2615
dispatch @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:638
M.handle @ vendor.min-0263b678a709a576c1af220f02dd58fc.js:633
#2

Hi @scu! 500 page is usually associated with 500 error response from the server, do you see any such responses in you ‘Network’ tab in developer tools? If so what are the response details?

The log you provided is of little help unfortunately, as it’s a stack trace from minified file.

#3

Hi, the ‘500’ is shown by the admin interface frontend, the request generated when I click posts receives a successful 200 header and a chunk of valid json. Any ideas how I get he admin interface to not use modified versions of the json?

P.s. I’ve performed updates since and problem is still there. I can see posts in the android app but am assuming that is calling via api.???.

#4

Have a couple more questions to get more clarity on your situation :slightly_smiling_face:

  • Which version of Ghost are you using?
  • What is your environment: db, configuration, etc?
  • Did you try rebuilding Ghost Admin?
  • Does the error happen when you visit /ghost/#/pages?
#5

HI Gargol,

  • 2.21.0 (upgraded from 2.19.x) but still same result
  • It’s a DigitalOcean standard image
  • Is there a specific way/command I should rebuild Ghost Admin?
  • /ghost/#/pages tags, users etc work fine. I can also click the + and add a new post.

I’ve checked the JSON returned from: https://www.**************.com/ghost/api/v2/admin/posts/?limit=30&page=1&filter=status%3A%5Bdraft%2Cscheduled%2Cpublished%5D and that appears to be valid.

#6

Update: I’ve had a dig in the database, posts table. The mobiledoc field on one of the posts contained the same content as the html field rather than the {"version":"0.3.1","atoms":[],"cards&quo [... used in the rest.

/ghost/#/posts is now working correctly.

The 500 error was a little misleading.

#7

Hm. Now I wonder what caused that html to get into mobiledoc field in the db :thinking: That should never happen unless directly manipulated in the db. Can you provide a bit more context on why it was there?

#8

That’s the confusing part. I’ve only just started to manually look at the database cause I’d exhausted other ideas.