Bitbucket Server 7.0+ Page Decorators and Plugins

Following guides online I have been attempting to create a page decorator for “bitbucket.repository.general” which is a bitbucket decorator defined here

I have been working through the examples located in the bitbucket-client-side-extensions-template but don’t see any examples for how to do this with client side extensions. (Bitbucket)

Does anyone know of a solution for this?

I tried this (initially I hard coded the meta tags just to get something working)

import { PageExtension } from '@atlassian/clientside-extensions';

 * @clientside-extension
 * @extension-point bitbucket.repository.nav
 * @label page-extension.label
 * @page-url /page-extension
 * @page-title page-extension.title
 * @page-decorator bitbucket.repository.general
export default PageExtension.factory(container => {
    container.innerHTML = (
            <meta name="projectKey" content="PROJECT_1"/>
            <meta name="repositorySlug" content="rep_1"/>
            <meta name="activeTab" content="extensions__repository__some-header-extension__js"/>

However a new page opens up with a 500 error and in the server logs I see these soy exceptions.

[INFO] Caused by: When evaluating "to_json($project)": While computing function "to_json($project)": null
[INFO]  at bitbucket.internal.layout.project.project.project(
[INFO] 2021-09-22 11:45:11,396 ERROR [http-nio-7990-exec-7]  o.a.c.c.C.[.[.[/bitbucket].[plugins] Servlet.service() for servlet [plugins] in context with path [/bitbucket] threw exception
[INFO] When evaluating "to_json($project)": While computing function "to_json($project)": null

Any help would be appreciated.

1 Like

@madamczak please take a look when you can

Could you try checking if removing the page decorator annotation from the JS file, and then running the plugin again is causing the same error?

- * @page-decorator bitbucket.repository.general

I removed the annotation and it is no long returning a 500 error, but now a new “atl.general” page is opening with none of the repository decoration.

I would like the page to be decorated with the repository page.

1 Like

Thanks for the update. I will report the issue and share the ticket with you later this week.

For now, what I can suggest is to use the standard Atlassian servlet class instead if you need to use bitbucket page decorators.

Sounds good. I will go the traditional servlet route. Thanks for looking into it @madamczak. I really appreciate the work you and your team do for the atlassian developer community.

1 Like