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

UHF-10466: Prevent suunte js aggregation #794

Merged
merged 3 commits into from
Aug 27, 2024
Merged

UHF-10466: Prevent suunte js aggregation #794

merged 3 commits into from
Aug 27, 2024

Conversation

rpnykanen
Copy link
Contributor

@rpnykanen rpnykanen commented Aug 21, 2024

UHF-10466

Drupal aggregation prevented suunte-chat initialization for some reason.

What was done

Prevent suunte-script aggregation

How to install

  • Make sure your instance is up and running on latest dev branch.
    • git pull origin dev
    • make fresh
  • Update the Helfi Platform config
    • composer require drupal/helfi_platform_config:dev-UHF-10466
  • Run make drush-updb drush-cr

How to test

  • Make sure the JS aggregation is enabled
    • (Go check local.settings.php and comment the js preprocess if not commented)
  • Go to hammashoita-page as anonymous user FINNISH language
  • Hammashoito-chat button should be visible
  • Open inspector, check network tab and filter by JS,
    • Check that the genesys_suunte.js is listed in the loaded JS files list (which means not aggregated)

Continuous documentation

  • This feature has been documented/the documentation has been updated
  • This change doesn't require updates to the documentation

…ggregation broke down the suunte_chat for anonymous user in production environment only
@juho-lehmonen juho-lehmonen self-requested a review August 22, 2024 06:34
Copy link
Contributor

@juho-lehmonen juho-lehmonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this error when trying to load the preprocessed JS file. Also, genesys_suunte.js isn't loaded individually. The Chat button shows up but doesn't work.

The website encountered an unexpected error. Try again later.

Exception: Only file JavaScript assets with preprocessing enabled can be optimized. in Drupal\Core\Asset\JsOptimizer->optimize() (line 34 of core/lib/Drupal/Core/Asset/JsOptimizer.php).

Drupal\Core\Asset\JsCollectionOptimizerLazy->optimizeGroup() (Line: 184)
Drupal\system\Controller\AssetControllerBase->deliver()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache->fetch() (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Also getting this JS error in the console on the Hammashoito page, but this also happens on the current platform config module version, so not sure if it's related:

Uncaught TypeError: can't access property "get", cookies is undefined
 getCookieStatus https://helfi-sote.docker.so/terveys-assets/modules/contrib/eu_cookie_compliance/js/eu_cookie_compliance.js?v=10.3.2:744

The cookies JS error is also triggered every time you try to click the chat button.

Copy link

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

Successfully merging this pull request may close these issues.

2 participants