Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Code Block Macro Hanging, how to resolve?

Code Block Macro will spin  (hang) when invoked explicitly such as by clicking the edit button. Partial work-arounds are available using {code

3 answers

0 votes

Hello James,

Welcome to Atlassian Community. It's nice to meet you.

You'll want to have a look at your Confluence Server logs as well as what's going on in the Developer Tools > Network console of your browser. This should tell you what it's hanging on.

You can feel free to share any messages you encounter there, as well as which version of Confluence you are running, and I can help you to determine the issue.

Regards,

Shannon

OK looked at the server logs nothing was there but the developer tools have a failure to load plugin from http://server:port/<rest of plugin url> and I'm certain the server does not respond to http: as that is considered an insecure protocol.

James, 

Can you verify that your base URL isn't set to the http version? It seems odd that the code macro would try to be accessing your site from that protocol.

Regards,

Shannon

looking at the Confluence administration page, Under CONFIGURATION in the general administration section the Server Base URL is set to https://<server_confluence_host_name>:<port> 
Also under administration in system information it shows the same Server Base URL

Thank you, James.

I suspect you might be running into this bug:

  • CONFSERVER-57934 Adding panel,excerpt,warning,note,tip or info macro to the page in edit mode will trigger mixed content action in browser

Specifically, it mentions the info, etc. macros, but it has affected other macros, such as the code block macro. This would depend on your version of Confluence, but it's been affecting the latest versions.

There's a workaround you can apply that has helped some users listed on the ticket. Could you give that a try and let me know if corrects the issue? If not, I would ask that you can record the behaviour into a HAR File so we can have a deeper look.

Regards,

Shannon

I tried to load the java script but either I did not load it in the proper area or it didn't work. BTW this happens in both IE11/Win10 and Chrome.

James,

Can you let me know where you added the javascript, and your exact version of Confluence?

Regards,

Shannon

1. I tried adding the script on the page where I was using the code block macro. Should I have added it to the Custom HTML on the Look and feel tab of the administration page
2. We have Confluence v7.01 installed.

Hi James,

The workaround says that it should be added in the Custom HTML section.

Workaround

Some users have found the below custom HTML resolves the issue in Chrome:

Copy text/code below into BODY section of Configuration --> Custom HTML

<script type="text/javascript">
  function fixFrameContent(frameContent, broken_url_prefix) {
    var replaced = false;
    // Replace broken img src urls
    frameContent.find("img").each(function(index) {
      var srcUrl = AJS.$(this).attr("src");
      if (srcUrl.toLowerCase().startsWith(broken_url_prefix)) {
        var srcNewUrl = srcUrl.substring(broken_url_prefix.length);
        AJS.$(this).attr("src", srcNewUrl);
        replaced=true;
      };
    });  // each img
     
    // Replace broken tables for macro - background img url is broken
    // Iterate over all relevant tables to check background-image URL
    frameContent.find("table.wysiwyg-macro").each(function(index) {
      AJS.log(AJS.$(this));
      var bgiRaw = AJS.$(this).css("background-image");
      if (!bgiRaw) return true;  // nothing to do, continue with next element
      // remove 'url(...)' around the content
      var bgiUrlMatch = bgiRaw.match(/url\(["']?(.*)["']?\)/);
      if (!bgiUrlMatch) return true;  // nothing to do, continue with next element
      var bgiUrl = bgiUrlMatch[1];
      if (bgiUrl.toLowerCase().startsWith(broken_url_prefix

Can you give that a try and let me know how it goes?

Regards,

Shannon

This didn't work. still get 400 errors that lead to code block macro spinning/hanging.

James,

Thank you for trying the workaround and confirming that it's not effective in your situation.

I'd like to raise a ticket for you in support, but I wasn't able to find a license associated with your email address. Could you confirm with me if you have a valid license currently?

Regards,

Shannon

Entered:  https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-261735
This is a short week. We had Columbus day on Moday and tomorrow, our 5-4-9 Friday off, however, I entered this through my gmail account so I could see it when I wasn't at wasn't at work given we're on GMT-0700 aka PDT (Los Angeles time zone). 

Hi James,

Thank you for confirming that.

I see my colleague replied to you before I had a chance to update the case with your details. Feel free to reply there with a copy of your HAR file and Support zip. I want to be able to confirm that you are indeed encountering the issue in the bug.

Thank you for your help.

Regards,

Shannon

Hi @James Rinkevich,

I see that your case with the support team is about to timeout since we haven't heard from you recently with a copy of your HAR file and support zip. You'll want to reply in the next day or so to avoid that happening! Let me know if you're having any trouble uploading files to the support portal.

Regards,

Shannon

We have exactly the same problem with the Code Block macro only. Please advise as we are not able to use it at all.

Confluence version: 6.15.6

We spotted the problem in our case and it had to do with a totally different plug-in we are using named Linchpin Events. An upgrade was available and once applied our problems went away.

Very unclear why Linchpin Events was in play at all on our offending page(s) where the Code Block macro was used, but no macros from Linchpin? 

Tom,

Thank you for letting us know about that. It could be that there's something running in the background from Linchpin Events that is causing this. I would also recommend contacting Linchpin to see if this is a known issue on their end.

Let me know if you have any trouble.

Regards,

Shannon

I have informed Linchpin (Seibert Media)

Like Shannon Spaniol likes this

Tom,

Thank you for confirming that! Take care, and have a pleasant rest of your week.

Regards,

Shannon

Linchpin fed back and confirmed that their patch that we applied was a bug fix of this exact case so they were aware.

Like Shannon Spaniol likes this

Tom,

That's great, thank you so much for the update!

Have a pleasant weekend.

Regards,

Shannon

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

342 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you