Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-6707

Incorrect resources are loaded based on condition in Customer Portal

      Issue Summary

      Atlassian plugin vendor are extending SimpleUrlReadingCondition according to https://bitbucket.org/atlassian_tutorial/tutorial-licensed-conditions/src/master/src/main/java/com/example/plugins/conditions/IsPluginLicensedCondition.java. When using this condition to load a web-resource in the customerportal context, the wrong resource is loaded.

      As a consequence:

      • a lot of Service Desk portal URLs are corrupted since the string "customer/portal/undefined/servicedesk" is being mistakenly added to it, and accessing such URL returns a 404 error with the message "Oops, you've found a dead link".
      • some functionalities from the customer portal will fail to work: for example, icon/avatar images might not be loaded on the customer, workflow transitions might fail on the customer portal, etc...

      For example:

      • Customer Portal Icons (Avatar):
        • A normal icon URL should be like this:
          <JIRA_BASE_URL>/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/undefined/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
      • Customer Portal Transition
        • A normal transition URL should be like this:
          <JIRA_BASE_URL>/rest/servicedesk/1/customer/requests/transition
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/portal/37/undefined/rest/servicedesk/1/customer/requests/transition
          

      Steps to Reproduce

      1. Create a test plugin that uses a condition to load resources on the customer portal (see screenshots/attachments)

      atlassian-plugin.xml snippet

          <web-resource key="test-true" name="test-true">
              <resource type="download" name="condition-true.js" location="/js/condition-true.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition"/>
          </web-resource>
      
          <web-resource key="test-false" name="test-false">
              <resource type="download" name="condition-false.js" location="/js/condition-false.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition" invert="true"/>
          </web-resource>
      

      Expected Results

      The resource associated with the TestCondition being true is loaded

      Actual Results

      The resource associated with the TestCondition being false is loaded

      Workaround

      Enable the feature flag sd.frontend.legacy.webresource.loading.customerportal.enabled:

      1. Go to Dark feature page (<baseURL>/secure/admin/SiteDarkFeatures!default.jspa)
      2. Add the following dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled

            [JSDSERVER-6707] Incorrect resources are loaded based on condition in Customer Portal

            Hi everyone, bc4ae08bb47a mma ab0a2b3627cc 817432d07859 d48a55e515a2 1b3662f488a9 8f5c9df38478 52e6fd720926 9264e510924d mfilipan c6804442ffa0 c7dfe7a6b4d2 

            I'm facing this issue again when create a test plugin with JSM 5.4.0. But my error requests are:

            • /servicedesk/customer/portal/undefined/rest/wrm/2.0/resources -> 404 not found
            • /servicedesk/customer/portal/1/create/undefined/rest/wrm/2.0/resources -> 404 not found
            • /servicedesk/customer/portal/undefined/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10627 -> 404 not found

            Does anyone have the solution for this bug? I tried the above workaround but it does not work in my case (adding the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled)

            Thanks and regards!

            Nguyen Thanh Long 20222169M added a comment - - edited Hi everyone, bc4ae08bb47a mma ab0a2b3627cc 817432d07859 d48a55e515a2 1b3662f488a9 8f5c9df38478 52e6fd720926 9264e510924d mfilipan c6804442ffa0 c7dfe7a6b4d2   I'm facing this issue again when create a test plugin with JSM 5.4.0 . But my error requests are: /servicedesk/customer/portal/ undefined /rest/wrm/2.0/resources -> 404 not found /servicedesk/customer/portal/1/create/ undefined /rest/wrm/2.0/resources -> 404 not found /servicedesk/customer/portal/ undefined /servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10627 -> 404 not found Does anyone have the solution for this bug? I tried the above workaround but it does not work in my case (adding the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled ) Thanks and regards!

            Also affects 4.13.15

            Jorden Van Bogaert added a comment - Also affects 4.13.15

            Martin Ma added a comment -

            Hi ab0a2b3627cc, you should remove the feature flag to enable the default behavior, which provide better performance on customer portal.

            Martin Ma added a comment - Hi  ab0a2b3627cc , you should remove the feature flag to enable the default behavior, which provide better performance on customer portal.

            Can someone tell me, if we upgrade to 4.15.0 or later, should we remove the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled?
            Or is it OK to leave it hanging around?

            Sherryl Radbil added a comment - Can someone tell me, if we upgrade to 4.15.0 or later, should we remove the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled? Or is it OK to leave it hanging around?

            Alexsandr added a comment -

            It's worked!

            Many Thanks!

            Alexsandr added a comment - It's worked! Many Thanks!

            g1patnaik added a comment -

            If no broken url issue in new version when legacy customer portal is disabled, why not disable it?

            g1patnaik added a comment - If no broken url issue in new version when legacy customer portal is disabled, why not disable it?

            Can someone tell me, if we upgrade to 4.15.0 or later, should we remove the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled?
            Or is it OK to leave it hanging around?

            Sherryl Radbil added a comment - Can someone tell me, if we upgrade to 4.15.0 or later, should we remove the dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled? Or is it OK to leave it hanging around?

            paulpayen added a comment -

            Workaround worked perfectly !

            Many Thanks ! this saved my day !

             

            paulpayen added a comment - Workaround worked perfectly ! Many Thanks ! this saved my day !  

            g1patnaik added a comment -

            For us, the fix is to disable http2 in reverse proxy server. At the same time, make sure HTTP/1.1 mentioned in tomcat server.xml.

            Or workaround as mentioned in the ticket: to use legacy customer portal version (one of the options in site dark features)

            g1patnaik added a comment - For us, the fix is to disable http2 in reverse proxy server. At the same time, make sure HTTP/1.1 mentioned in tomcat server.xml. Or workaround as mentioned in the ticket: to use legacy customer portal version (one of the options in site dark features)

            Aliaksei Shorkin added a comment - - edited

            Suggested workaround helped! Thanks!

            Whole day was wasted to fix this. After diasabilng plugins and deleting custom fields , I searched google with "service desk undefined" and found this page.

            Aliaksei Shorkin added a comment - - edited Suggested workaround helped! Thanks! Whole day was wasted to fix this. After diasabilng plugins and deleting custom fields , I searched google with "service desk undefined" and found this page.

              Unassigned Unassigned
              c7dfe7a6b4d2 Heiko Gerlach
              Affected customers:
              17 This affects my team
              Watchers:
              61 Start watching this issue

                Created:
                Updated:
                Resolved: