Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'pageTitle') #35

Open
beyondlex opened this issue Jul 25, 2024 · 6 comments
Open

Cannot read properties of undefined (reading 'pageTitle') #35

beyondlex opened this issue Jul 25, 2024 · 6 comments

Comments

@beyondlex
Copy link

When I execute the antora command, i get the following error:

info:     Publishing Dash to Confluence
info:     Initializing state
info:     Decoding Confluence state
info:     Removing untracked pages
info:     Publishing pages
info:     Processing worktree.html
[17:30:07.783] FATAL (antora): Cannot read properties of undefined (reading 'pageTitle')

Here is my configuration:

output:
  destinations:
    - provider: fs
    - provider: antora-confluence
      confluence-api: http://.../rest/api
      confluence-space: 'myspace'
      ancestor-id: 1016484
      filter:
        - path: tool/git

Is there something wrong with my configuration? Thank you for your help!

@beyondlex
Copy link
Author

I forked the code and debugged it. I found that the issue lies with the filter. The filter restricts the pages involved in the current generation, but the pages reference other pages that are not included in this generation, causing the error.

@PacoVK
Copy link
Owner

PacoVK commented Jul 25, 2024

Thanks for contributing! Until now, filtering pages means you need to take care of the "page dependencies" to avoid broken links. The PR now would introduce a behaviour that makes it legit to have broken links and i am not sure about that. Maybe we should cover this with an explicit knob to be configured to actively agree that this is intended, instead of implicitly forcing that. What do you think? I could think of a setting like ignore_broken_links?

@beyondlex
Copy link
Author

Yes, I completely agree with your point of view. Some people prefer to ignore non-existent references to prioritize passing the compilation, while others prefer the compilation to fail to highlight which reference files were missed. Providing an option is the right approach.

beyondlex pushed a commit to beyondlex/antora-confluence that referenced this issue Jul 26, 2024
@PacoVK
Copy link
Owner

PacoVK commented Aug 15, 2024

just checking to avoid duplicate efforts, @beyondlex are you working on this and come up with a PR at some point? (no time pressure) :)

@slonopotamus
Copy link
Contributor

slonopotamus commented Sep 19, 2024

I found out that exactly the same error (Cannot read properties of undefined (reading 'pageTitle')) happens if one page attempts to reference an element inside other page using xref:other-page.adoc#fragment-id[text] syntax even if the xref is absolutely correct:

[17:16:05.033] FATAL (antora): Cannot read properties of undefined (reading 'pageTitle')
    Cause: TypeError
        at C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\lib\transformer\LinkTransformer.js:101:140
        at Array.forEach (<anonymous>)
        at rewriteInternalLinks (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\lib\transformer\LinkTransformer.js:80:41)
        at convertHtmlToConfluence (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\lib\service\HtmlToConfluenceConverter.js:22:69)
        at processPage (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\lib\service\PageService.js:288:94)
        at publish (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\lib\service\PageService.js:178:40)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
        at async publishToConfluence (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\antora-confluence\dist\index.js:39:9)
        at async Promise.all (index 1)
        at async generateSite (C:\Users\marat\OneDrive\Documents\ssg1\docs\node_modules\@antora\site-generator\lib\generate-site.js:53:12)

UPD: Correction, this only happens if I have html_extension_style: indexify in my antora-playbook.yml.

@lucom-hm
Copy link

Hi @PacoVK , I got the same message when trying to include an image using image::example-form.png[link=self] (having read that it's not supported yet but on your roadmap). Just to let you know that there are other reasons for the same error message.

Kind regards
Henning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants