Stream wrapper reference in JS library causes error in _locale_parse_js_file()

Created on 28 May 2016, almost 9 years ago
Updated 20 October 2023, over 1 year ago

Problem/Motivation

I tried adding a local cached libary to libraries.xml file and referenced it properly. Per data_types.library.xml this is something that works for sure with CSS, but with JS it seems failing.

google_analytics.cached:
  remote: https://developers.google.com/analytics/devguides/collection/analyticsjs/
  version: VERSION
  license:
    name: ยฉ Google
    gpl-compatible: false
  js:
    'public://google_analytics/analytics.js': { async: true, minified: true, preprocess: false }
The website encountered an unexpected error. Please try again later.

Exception: Only local files should be passed to _locale_parse_js_file(). in _locale_parse_js_file() (line 1141 of core\modules\locale\locale.module).

locale_js_translate(Array) (Line: 503)
locale_js_alter(Array, Object, NULL) (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('js', Array, Object) (Line: 276)
Drupal\Core\Asset\AssetResolver->getJsAssets(Object, ) (Line: 298)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 161)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object) (Line: 179)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 161)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Fix the bug.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Localeย  โ†’

Last updated 2 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024