cosmere
cosmere copied to clipboard
Cosmere crashes with `TypeError: Cannot read property 'filter' of undefined`
It's been a while since I've used Cosmere, so I just upgraded to v0.16.0 of Cosmere and it now crashes when running npx cosmere
:
$ npx cosmere
▶ start Starting to render "posts/test.md"
✖ fatal TypeError: Cannot read property 'filter' of undefined
My cosmere.json
:
{
"baseUrl": "<BASE_URL>",
"personalAccessToken": "<TOKEN>",
"cachePath": "build",
"prefix": "This blog post was automatically converted from Markdown. For comments please use the comment section below as inline comments will get lost when re-uploading",
"pages": [
{
"pageId": "<POST_ID>",
"file": "posts/test.md",
"title": "Test"
}
]
}
The file posts/test.md
is empty but the same error occurs with any other file I've tried.
The issue seems to be this line. Replacing remoteAttachments
with (remoteAttachments || [])
seems to fix the issue. However, in this case another exception is thrown on line https://github.com/mihaeu/cosmere/blob/main/src/UpdatePage.ts#L50:
TypeError: Cannot read property 'storage' of undefined
at isRemoteUpdateRequired
This is starting to look like an API mismatch?
Hey 👋 welcome back and thanks for the report. This week is a bit tricky, but I'll try to check it out asap.
Are you using this on a hosted or cloud Confluence?
Thanks for the quick response and the warm welcome. :)
It's a hosted instance. According to the team responsible for it, last time I ran cosmere successfully they were running Confluence v7.13.0. Currently it's 7.13.7. So an API change is starting to look unlikely. Looks like I'll to have to debug the network requests… sigh. :)
I also checked and newest versions, even Confluence Cloud works just fine. I've been facing a couple of those in the last few patches. The markdown converter I'm using as a base made a lot of incompatible changes, but the old version has major security issues :( this doesn't seem to be the case for your example however :thinking:
Is the old version of cosmere still working for you? Are there maybe some attachments uploaded to which the API user has no access to? Trying to figure out how to reproduce this.
Good news is that I figured out that Atlassian hands out free developer accounts and I got my hands on one. So now I can add integration tests against an actual instance to the GitHub actions which should make future updates a lot safer :crossed_fingers:
Is the old version of cosmere still working for you?
No, unfortunately it doesn't. :\
Are there maybe some attachments uploaded to which the API user has no access to?
I created a new page from scratch, so there shouldn't be any attachments.
As for integration tests: That's great news! Once those integration tests are in place, maybe I could run them against our instance to see what's up.