Code from dart2js is throwing NoSuchMethodErrors for get$functions - dart

My Polymer.dart web app, that works fine in Dartium, is giving the following error (it repeats seven times) when compiled with dart2js using pub build --mode=debug and loaded in Chrome.
Resource interpreted as Script but transferred with MIME type text/plain: "http://confab.dev/index.html_bootstrap.dart". confab.dev/:10
warning: file:///home/dan/projects/confabulous/webatara/web/index.html.0.dart library not found index.html_bootstrap.dart.js:17188
Uncaught Error: NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:17188
Stack Trace:
TypeError: Object #<JsLibraryMirror> has no method 'get$functions'
at dart._loadLibrary (http://confab.dev/index.html_bootstrap.dart.js:20000:19)
at dart._loadLibraries (http://confab.dev/index.html_bootstrap.dart.js:19917:11)
at dart._initPolymerOptimized (http://confab.dev/index.html_bootstrap.dart.js:19908:7)
at dart.initPolymer (http://confab.dev/index.html_bootstrap.dart.js:19902:7)
at main (http://confab.dev/index.html_bootstrap.dart.js:4112:7)
at _IsolateContext.eval$1 (http://confab.dev/index.html_bootstrap.dart.js:1369:23)
at dart.startRootIsolate (http://confab.dev/index.html_bootstrap.dart.js:1145:21)
at http://confab.dev/index.html_bootstrap.dart.js:26514:7
at init.currentScript (http://confab.dev/index.html_bootstrap.dart.js:26494:5)
at http://confab.dev/index.html_bootstrap.dart.js:26508:3
index.html_bootstrap.dart.js:17188
Uncaught NoSuchMethodError: Cannot call "get$functions" on "#<JsLibraryMirror>" (Object #<JsLibraryMirror> has no method 'get$functions') index.html_bootstrap.dart.js:2369
Because source maps don't appear to work (they're turned on in Chrome, and I have .map files), I don't even know which part of my code is causing this.
I've tried with interop.js included both before dart.js, as the docs say, and after, as this issue says.

Looks like a bug in dart2js. Please file an issue, ideally with a reproducible test-case.

pub upgrade fixed it. It turns out that something had replaced the polymer 0.9.5 that I'd been using with 0.8.10+4. Quite odd. The solution to this is to set the polymer version as '>= 0.9.5' instead of 'any', which I will do eventually, but for now I'm interested to see if it happens again.

Related

Nestjs TypeError: applicationConfig.getVersioning is not a function

I have reinstalled #nestjs/swagger and swagger-ui-express. All my dependencies are up to date. But I get this error:
applicationConfig.getVersioning is not a function at SwaggerExplorer.exploreRoutePathAndMethod
I have updated metadata tags in tsconfig.ts file as well. After debugging, I can find that the main issue is at line where createDocument function is called from Swagger Module class. Every code line before that works fine.
On console logging, I even could extract the values of config-correctly. However, once the createDocument method is called, the API comes to a crashing halt with the above stated error.
/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:125
const controllerVersion = this.getVersionMetadata(metatype, applicationConfig.getVersioning());
^
TypeError: applicationConfig.getVersioning is not a function
at SwaggerExplorer.exploreRoutePathAndMethod (/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:125:87)
at /home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:72:45
at Array.reduce ()
at /home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:71:99
at /home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:13469:38
at /home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:3032:24)
at Function.mapValues (/home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:13468:7)
at MapIterator.iteratee (/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:71:45)
at MapIterator.next (/home/prasanna/my_project/TapisProject/API/API/node_modules/iterare/src/map.ts:9:39)
need to upgrade #nestjs/core as well –

Which way to go with these bugs

Compiling Dart app to js these two errors arise:
Nº1:
InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element': a type with that name is already registered.
Nº2:
Breaking on exception: TypeError: Object #<qE> has no method 'vL'
The object qE is created by dart2js.
How to find the solution?
There are appropriate tools to find the solution?
Thanks for advance !
I heard N1 occurs when Angular and Polymer is used in the same app. This is a known bug.
related open issues:
- duplicate polymer-element registration should not break the app
- Get error "Uncaught InvalidStateError: Failed to call 'register' on 'Document' for type 'polymer-element'
For the N2 use pub build --mode=debug so you get unmangled names and then use one of the available strategies to fix the problem (use of MirrorsUsed, #observable, #reflectable)

Debugging MirrorsUsed

I'm trying to figure out which libraries I need to pass to #MirrorsUsed to get my app compiled and working. Sometimes, it's easy to figure out which library may be missing since a descriptive error is thrown such as Uncaught Unsupported operation: Cannot find class for: NgAttr .
Other times, I get a more obscure message, such as NullError: Cannot call "$gt" on null with no clue as to which library I may be omitting. Is there a better approach to this, besides trial and error?
In case you're wondering, this is an angular app and this is how I currently have it configured:
#MirrorsUsed(targets: const[
'angular',
'angular.core',
'angular.core.dom',
'angular.filter',
'angular.perf',
'angular.directive',
'angular.routing',
'angular.core.parser.dynamic_parser',
'angular.core.parser.lexer',
'todo',
'perf_api',
'List',
'NodeTreeSanitizer',
'PlaybackHttpBackendConfig'
],
override: '*')
import 'dart:mirrors';
Use
pub build --mode=debug
this does tree shaking but retains (mostly) the original Dart names.
Then debugging the generated JavaScript usually lets deduce the source of the exception.
EDIT
IMHO these are not necessary anymore, because they were added to #MirrorsUsed in the Angular libs.
'angular',
'angular.core',
'angular.core.dom',
'angular.filter',
'angular.perf',
'angular.directive',
'angular.routing',
'angular.core.parser.dynamic_parser',
'angular.core.parser.lexer',

Recurring problems in Dart polymer project

I am having a problem that seems to be due to caching of dart packages etc.
My work machine runs some dart polymer examples without any problem. I use the same project on my home machine it it consistently gives the exception below:
Exception: Class '_textfieldElementExtension' has no instance method 'createInstance'.
NoSuchMethodError : method not found: 'createInstance'
Receiver: Instance of '_textfieldElementExtension#0x1d7f4e'
Arguments: [Instance of 'MyExample', Instance of 'PolymerExpressions']
PolymerElement.instanceTemplate (package:polymer/src/instance.dart:383:30)
PolymerElement.shadowFromTemplate (package:polymer/src/instance.dart:233:31)
PolymerElement.parseDeclaration (package:polymer/src/instance.dart:202:34)
PolymerElement.parseDeclarations (package:polymer/src/instance.dart:194:23)
PolymerElement.prepareElement (package:polymer/src/instance.dart:170:22)
PolymerElement.created (package:polymer/src/instance.dart:152:21)
_initCustomElement (package:custom_element/custom_element.dart:622:18)
registerCustomElement (package:custom_element/custom_element.dart:62:25)
I know that DartEditor places file .dartium and DartEditor in the users directory. Apart from these directory and the installation directory of the editor itself, where else are DartEditor files placed?
Thanks
There is a directory where the downloaded packages are stored. (~/.pub-cache for linux, don't know Windows).

Console error with example of ui.bootstrap.datepicker

I try to use angular-ui-bootstrap datepicker and it upset me for a while with an error on firebug console (Firefox 21) saying
Error: array is undefined
indexOf#http://localhost:9000/components/angular/angular.js:526
arrayRemove#http://localhost:9000/components/angular/angular.js:535
JQLiteUnbind#http://localhost:9000/components/angular/angular.js:1630
JQLite.prototype[name]#http://localhost:9000/components/angular/angular.js:2203
.link/<#http://localhost:9000/components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js:1
Scope.prototype.$digest#http://localhost:9000/components/angular/angular.js:7942
Scope.prototype.$apply#http://localhost:9000/components/angular/angular.js:8143
done#http://localhost:9000/components/angular/angular.js:9170
completeRequest#http://localhost:9000/components/angular/angular.js:9333
createHttpBackend/</xhr.onreadystatechange#http://localhost:9000/components/angular/angular.js:9304
http://localhost:9000/components/angular/angular.js
Line 5754
After I check every datepicker settings I check the given example in documentation, followed the link "edit it on plunker" and I got a similar error.
Error: array is undefined
indexOf#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:510
arrayRemove#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:519
JQLiteUnbind#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1596
JQLite.prototype[name]#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2149
.link/<#http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js:1229
Scope.prototype.$digest#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:7878
Scope.prototype.$apply#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:8079
bootstrap/<#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:962
invoke#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2843
bootstrap#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:961
angularInit#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:936
#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:14729
trigger#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1723
createEventHandler/eventHandler/<#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1958
forEach#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:133
createEventHandler/eventHandler#http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1957
http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js
Line 5687
Then I try Chrome Version 26.0.1410.63 and I got a different error
TypeError: Cannot read property 'indexOf' of undefined
at indexOf (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:510:12)
at arrayRemove (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:519:15)
at JQLiteUnbind (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:1596:7)
at Object.JQLite.(anonymous function) [as unbind] (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2149:17)
at Object.fn (http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js:1229:21)
at Object.Scope.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:7878:27)
at Object.Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:8079:24)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:962:13
at Object.invoke (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:2843:25)
at bootstrap (http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.js:960:12)
It works but the error message upset me a lot and I thought that was something wrong with my code.
Can I assume this is not related with example given but with some internals or is the example missing something?
ui-bootstrap 0.5.0 has a bug,
(it tries to unbind 'focus' event handler, but handler doesn't exist)
https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.5.0.js#L1226
you can apply this changes
https://github.com/angular-ui/bootstrap/commit/bf30898da27272df75f6c7ff26545ed16ebf1978
or build it directly from github
or wait for 0.6.0

Resources