Uncaught ReferenceError: ol is not defined - plone

Environment: Plone 5.0.6, OpenLayers 3.11.0
I want using sample codes at https://github.com/GaborFarkas/mastering_openlayers3/archive/v1.1.zip to work within my Plone instance. You can see the custom package code at https://github.com/l34marr/my.map/tree/world-capitals that tries to read a GeoJSON file and display features on the VectorLayer.
At first I run into the following errors:
Uncaught ReferenceError: ol is not defined
Uncaught Error: Mismatched anonymous define() module: function () { ...
By guessing, a workaround seems fix the above issue: changing the order of two lines in main_template.pt as follows:
<metal:javascriptslot define-slot="javascript_head_slot" />
<div tal:replace="structure provider:plone.scripts" />
This way, the errors are gone and everything seems working as expected. See the screenshot for reference.
Question: What causes the error? What's the recommended hints to debug and fix the issue?

Related

SSR compile fails with TailwindCSS "Cannot read properties of undefined (reading '5')

I am making a Github pages site with SvelteKit and Tailwind CSS as a learning project.
I am using Adaptor static to render the site for hosting on github pages so everything ends up getting Server side pre rendered.
Error:
[postcss] Cannot read properties of undefined (reading '5')
21:35:57 [vite-plugin-svelte] ssr compile in progress ...
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
Error: Not found: /favicon.ico
at resolve (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:395:13)
at resolve (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:236:5)
at Object.#options.hooks.handle (/#fs/D:/Repositories/myrepo/node_modules/#sveltejs/kit/src/runtime/server/index.js:41:55)
at Module.respond (/node_modules/#sveltejs/kit/src/runtime/server/respond.js:233:40)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading '5')
at Parser.parentheses (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:859:65)
at Parser.parse (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1062:14)
at Parser.loop (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:1043:12)
at new Parser (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\parser.js:164:10)
at Processor._root (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:53:18)
at Processor._runSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:100:21)
at Processor.astSync (D:\Repositories\myrepo\node_modules\postcss-selector-parser\dist\processor.js:145:17)
at finalizeSelector (D:\Repositories\myrepo\node_modules\tailwindcss\lib\util\formatVariantSelector.js:125:59)
at D:\Repositories\myrepo\node_modules\tailwindcss\lib\lib\generateRules.js:732:81
at D:\Repositories\myrepo\node_modules\postcss\lib\container.js:96:18
I have a Svelte component that has a named tailwind group so that i can do some conditional highlighting.
The basics of the component are like this:
<script>
export let id;
export let title;
const setting= `group/${id}`
</script>
<div class="{setting}">
<div
class="{`group-hover/${id}:bg-blue-500`}"
>
{title}
</div>
<slot/>
</div>
This works in this REPL that uses tailwind strangely! is this issue just to do with SSR?
https://svelteboard.com/repl
When i made this component I had inline declarations of the class with a prenamed group/name like this:
<div class="group/name">
<div
class="group-hover/name:bg-blue"
>
{title}
</div>
<slot/>
</div>
that worked fine (but highlighted all instances of the component on hover.)
but when i changed to the newer implementation it breaks with the above error & even when i roll back to a previous check in the error persists.
Am i implementing something wrong,
my tailwind config is unmodified from the svelte + tailwind setup, and svelte config has vitePreprocess and adapterstatic only.
I Tried updating dependencies to latest versions
downgrading postcss to 8.2 (suggested by another question)
reverting to previous revision, (does fix eventually but still cant implement this feature)
According to docs you cannot define dynamic CSS like group-hover/${id}:bg-blue-500 (Read here). All classes should be defined during build time.
You don't need to use nested groups if there is only one group in the component. Take a look at this REPL.
(If this is not the effect you're looking for please add a REPL with a minimum reproducible example)
#notnavindu's answer is correct
I think you can also refer to this

Suddenly not able to load HERE maps.Not even on their examples website

I am not able to load HERE maps, on any of my environments like dev, stage, or prod.
The problem seems to be with the HERE maps mapsjs-core.js .
I have further investigated, but it's not even loading on their examples section or on stackblitz.
The specific errors are :
Uncaught TypeError: Cannot read property 'length' of undefined
at new Fk (mapsjs-core.js:269)
at eval (eval at <anonymous> (mapsjs-core.js:71), <anonymous>:16:464)
at Object.eval (mapsjs-core.js:71)
at mapsjs-service.js:7
strong text

An error occurred getting entities in Linkedin's WhereHows

After installing Linkedin's WhereHows following the github docs (https://github.com/linkedin/WhereHows/blob/master/wherehows-docs/getting-started.md#getting-started), logging into the web UI, and navigating to the Datasets tab, it complains
An error occurred getting entities
SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data
Looking at the developer console in the web browser, can see the error outputs
SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data[Learn More] vendor-01c52695e9f268de5628f7bec75d6bb1.js:65255:14
tryCatcher http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65255:14
invokeCallback http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65437:15
publish http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65422:9
Queue</Queue.prototype.invoke http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:27963:17
Queue</Queue.prototype.flush http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:27848:25
DeferredActionQueues</DeferredActionQueues.prototype.flush http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28035:25
Backburner</Backburner.prototype.end http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28169:26
Backburner/this._boundAutorunEnd http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28131:17
Unhandled promise rejection SyntaxError: JSON.parse: unexpected character at line 3 column 1 of the JSON data
Stack trace:
tryCatcher#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65255:14
invokeCallback#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65437:15
publish#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:65422:9
Queue</Queue.prototype.invoke#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:27963:17
Queue</Queue.prototype.flush#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:27848:25
DeferredActionQueues</DeferredActionQueues.prototype.flush#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28035:25
Backburner</Backburner.prototype.end#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28169:26
Backburner/this._boundAutorunEnd#http://localhost:9001/assets/assets/vendor-01c52695e9f268de5628f7bec75d6bb1.js:28131:17
Does anyone know what this error means and where to look to investigate further (first time working with wherehows and the given output on its own it not very helpful to my uninitiated self)?
** Note my configuration variables for the Play frontend (https://github.com/linkedin/WhereHows/blob/master/wherehows-docs/getting-started.md#frontend-setup) look like
export WHZ_DB_USERNAME="wherehows"
export WHZ_DB_PASSWORD="wherehows"
export WHZ_DB_URL="jdbc:mysql://localhost/wherehows"
export WHZ_ES_DATASET_URL="localhost:9200/wherehows"
export WHZ_ES_METRIC_URL="localhost:9200/_nodes/stats" (honestly don't know if this is correct (don't use elasticsearch much))
export WHZ_ES_FLOW_URL="localhost:9200/wherehows/flows_jobs"
export YOUR_HDFS_BROWSER_LINK="http://node004.myco.local:8888/filebrowser/#"
export WHZ_LDAP_URL="ldap://co.myco.local:389"
export WHZ_LDAP_PRINCIPAL_DOMAIN="#co.local"
export WHZ_LDAP_SEARCH_BASE="ou=mapr access,dc=co,dc=local"
Looking at this github issue seems to dedscribe something similar recent problem (around May 1, 2018) (https://github.com/linkedin/WhereHows/issues/1131#issuecomment-385882867). The response is in chinese, but using google translate it reads:
The latest code has a dao method did not write SQL, throw an exception directly, may be the author has not finished, you can try to use the 1.0.0 this tag, I tried this is no problem
So checking out the commit with tag v1.0.0
git checkout tags/v1.0.0
Adding redoing the parts of the installation that needed redoing (eg. adding the extralibs, setting the frontend configuration variables, starting the front- and backends), I see that error message no longer appears.

`Exception in template helper: TypeError: Cannot read property 'undefined' of undefined

I made a site using Telescope but when load I get this error message in my browser-console. How to fix this error.
Exception in template helper: TypeError: Cannot read property 'undefined' of undefined
at Object.Template.avatar.helpers.size (http://localhost:3000/packages/utilities_avatar.js?76304dc56cbb0aaaef4d60c3d930750cea5ac835:96:37)
at bindDataContext (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2880:16)
at Blaze._wrapCatchingExceptions (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1651:16)
at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2928:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12)
at wrapHelper (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2927:27)
at Spacebars.call (http://localhost:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:172:18)
at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:109:25)
at Object.Spacebars.mustache (http://localhost:3000/packages/spacebars.js?7bafbe05ec09b6bbb6a3b276537e4995ab298a2f:113:39)
at Template.avatar.HTML.DIV.class (http://localhost:3000/packages/utilities_avatar.js?76304dc56cbb0aaaef4d60c3d930750cea5ac835:48:82)
Here is answer for your problem: Stack-link
Read about guarding, problem you have appears due to missing variable / key / method, because it is not yet loaded. It mostly works cause it gets loaded but unless it comes to webbrowser you recieve this error message.
Go and look through your app and look close to the Template's name and the helpers, events. Maybe a Template.yourtemplate.helper or Template.yourtemplate.event isnt equal with your HTML Template name

Parsing Meteor error: Exception from Deps afterFlush

I get these Deps errors from time to time and I can never figure out what they mean or what they're pointing to:
Exception from Deps afterFlush function function: SyntaxError: Unexpected identifier
at eval (native)
at http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:372:22
at Function.jQuery.extend.globalEval (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:373:7)
at jQuery.ajaxSetup.converters.text script (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9806:11)
at ajaxConvert (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:8873:18)
at done (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9293:15)
at callback (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9753:8)
at Object.send (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9759:7)
at Function.jQuery.extend.ajax (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9244:15)
at Function.jQuery._evalUrl (http://localhost:4000/packages/jquery.js?265926494aaa3929cd2e30da265211c5929f37a4:9409:16) debug.js:41
It thinks that there is a syntax error, but the only files it points to are jquery.js, which I HIGHLY doubt contain errors...
This error is caused by code in a Template helper somewhere that uses JQuery/a jquery plugin and is running code using eval which contains a syntax error in it, which is why it appears to come from JQuery itself.
There isn't much more than this to go off im afraid. It might be from ajax. Have a look at your chrome's network tab to see what is being downloaded just before this happens and see if it contains any javascript.
If it contains HTML when it should contain javascript check your Meteor paths, Meteor does not throw 404 errors, instead it serves out the main page's html, which may be why the error displays this way instead of a 404
I just came across the similar "afterFlush" error, and while my error was also rooted in a jQuery/plugin with Meteor, it had nothing to do with eval.
The issue circled back around to updating the DOM at the same time I was updating a reactive method, where Meteor was also updating the DOM reactively. I found this out, and removed the manual DOM manipulation, which made this error go away. Hope someone else finds this helpful...

Resources