You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I'm writing a P2 plugin for Confluence. This code transforms a .js file on the fly using the Web Resource Transformer. Everything works absolutely perfectly in a barely-configured developer plugin instance (created from running `atlas-debug`), but when I connect to a real staging server (highly configured & customized with many plugins). Version numbers don't seem to be an issue, since if I match the staging servers' version numbers, I observe the same result. But in any case, I've tried with both 7.19.8 and 7.13.7.
On the development environments, I see something like this:
/* module-key = 'confluence.extra.jira:web-resources', location = 'templates/extra/jira/jiraIssues.js' */
{code...}
;
On the two staging servers, I observed identical behavior:
try{
/* module-key = 'confluence.extra.jira:web-resources', location = 'templates/extra/jira/jiraIssues.js' */
{code...}
}catch(e){WRMCB(e)};
;
This try/catch code block is repeated for each of the scripts that are being compiled (100s of times). The issue I see is that on the staging servers, `}catch(e){WRMCB(e)}` to close out the try/catch block never comes, so it fails. I want to find out what is generating these try/catch code blocks to see if I can find some reference or perhaps even support, but my searches so far are coming up empty.
Here is the relevant portion of the atlassian-plugin.xml
<web-resource key="js-transform-javascript">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<transformation extension="js">
<transformer key="js-transformation" />
</transformation>
<resource type="download" name="/js/js-mod.js" location="/js/js-mod.js" />
<context>atl.general</context>
</web-resource>
<web-resource-transformer key="js-transformation" class="com.example.app.jsTransformer" />
Two final notes: when I examine the failing code, I can observe that the correct transformation has taken place. And when I manually append the closing code fragment, the javascript loads without errors:
}catch(e){WRMCB(e)};
;
It turns out that the "WRMCB" refers to the Web Resource Manager Catch Block. It's part of production environments, but for obvious reasons, it's disabled by default in Dev Environments. If you need to enable this to debug the functionality (or your plugin in a test environment) you can do so using the following command:
atlas-debug -Dplugin.webresource.javascript.try.catch.wrapping=true
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.