fetch-client icon indicating copy to clipboard operation
fetch-client copied to clipboard

Version 1.8.0 does not work in Android Cordova App

Open clmorales opened this issue 6 years ago • 7 comments

I have an Android app using cordova and Aurelia. The app uses aurelia-fetch-client 1.3.1. When I tried to create a new app using aurelia-fetch-client 1.8.0 the does not start on device. Error log shows io.cordova.hellocordova I/chromium: [INFO:CONSOLE(12730)] "Uncaught SyntaxError: Unexpected token {", source: file:///android_asset/www/scripts/vendor-bundle.js (12730)

When I downgrade the version to 1.3.1 it works fine again.

clmorales avatar Feb 02 '19 00:02 clmorales

@clmorales Thanks for filing this. Can you help try with a lower version of fetch client? Maybe 1.8.0 or 1.7.0?

bigopon avatar Feb 02 '19 01:02 bigopon

Hi I tried Version 1.7.0 and It Works, so the problem it is on 1.8.0 only.

clmorales avatar Feb 02 '19 02:02 clmorales

@clmorales I think you are probably get similar issues with this https://github.com/aurelia/path/issues/29

But that guess could incorrect if the Android Webview supports newer features of JavaScript. It's still worth a try and test. Can you give a bit more info about the environment where it got the error?

bigopon avatar Feb 02 '19 02:02 bigopon

@bigopon not sure if it helps, but we have (stupidly) export class ApiClient extends HttpClient { and that stopped working in 1.8.0 with hmm HttpClient needs to be create with new or so

doktordirk avatar Feb 12 '19 14:02 doktordirk

@doktordirk Could you help with a simple snippet or repro and somemore details on how it fails? I think I'm a bit confused what kind of issues you are running into.

bigopon avatar Feb 12 '19 14:02 bigopon

Message: Class constructor HttpClient cannot be invoked without 'new'
Inner Error Stack:
TypeError: Class constructor HttpClient cannot be invoked without 'new'    
at new ApiClient (http://localhost:8080/static/webpack/commons.bundle.js?v=2c0c4b27cccd6e20f740f77a3f752d1a62d23077:84999:63)    
export class ApiClient extends HttpClient {
  constructor() {
    super();

    this.configure(config => {
      config
        .useStandardConfiguration()

babel 6 transpiled

var ApiClient = exports.ApiClient = function (_HttpClient) {
	  _inherits(ApiClient, _HttpClient);
	
	  function ApiClient() {
	    _classCallCheck(this, ApiClient);
	
	    var _this = _possibleConstructorReturn(this, _HttpClient.call(this));   /// <--- line  84999
	
	    _this.configure(function (config) {
	      config.useStandardConfiguration().withBaseUrl(API_BASE).withDefaults({
	```

doktordirk avatar Feb 12 '19 14:02 doktordirk

@bigopon retried with babel 7 and there it works with 1.8.0

doktordirk avatar Feb 12 '19 15:02 doktordirk