You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2020/01/26 20:19:27 UTC

[GitHub] [cordova-plugin-file] Gabrielr2508 opened a new issue #375: Uknown error on read a file

Gabrielr2508 opened a new issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375
 
 
   # Bug Report
   
   ## Problem
   
   I'm trying to update the plugin from version 1.3.3 to version 6.0.2. The write works as expected but the read don't works. I'm receiving "Invalid action" message in the error code.
   
   
   
   ### What is expected to happen?
   
   The method readAsText works as expected.
   
   ### What does actually happen?
   
   An uknown error is returned.
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   Here is the code
   ```javascript
   window.resolveLocalFileSystemURL(Dengues.getPath(true), function(entry) {
     console.log(entry)
     entry.file(function(dbFile) {
       console.log(dbFile)
       var reader = new FileReader();
       console.log(reader)
       reader.onloadend = function(evt) {
         var strjson = evt.target.result;
         console.log(evt)
       };
         reader.readAsText(dbFile);
     });
   });
   ```
   The file
   ```json
   FileEntry {isFile: true, isDirectory: false, name: "Dengues_2020-01-26_16-08-45.db", fullPath: "/Dengues_2020-01-26_16-08-45.db", filesystem: FileSystem, …}
   filesystem: FileSystem {name: "files-external", root: DirectoryEntry}
   fullPath: "/Dengues_2020-01-26_16-08-45.db"
   isDirectory: false
   isFile: true
   name: "Dengues_2020-01-26_16-08-45.db"
   nativeURL: "file:///storage/emulated/0/Android/data/com.sysvale.esus_ace/files/Dengues_2020-01-26_16-08-45.db"
   ```
   The error
   ```json
   FileReader {_readyState: 0, _error: null, _result: null, _progress: null, _localURL: "", …}
   _error: FileErrorcode: "Invalid action"
   __proto__: Object
   _localURL: "cdvfile://localhost/files-external/Dengues_2020-01-26_16-08-45.db"
   _progress: 0
   _readyState: 2
   _realReader: FileReader {readyState: 0, result: null, error: null, onloadstart: null, onprogress: null, …}
   _result: null
   error: (...)
   onabort: (...)
   onerror: (...)
   onload: (...)
   onloadend: (...)
   onloadstart: (...)
   onprogress: (...)
   readyState: (...)
   result: (...)
   __proto__: Object
   
   ```
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Platform: Android@6.0.4
   Device: Emulator and Samsung Tablet T280
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova: 9.0.0
       "cordova-android-support-gradle-release": "^3.0.1",
       "cordova-plugin-camera": "^4.1.0",
       "cordova-plugin-device": "^2.0.3",
       "cordova-plugin-dialogs": "^2.0.2",
       "cordova-plugin-file": "^6.0.2",
       "cordova-plugin-geolocation": "^4.0.2",
       "cordova-plugin-keyboard": "^1.2.0",
       "cordova.plugins.diagnostic": "^5.0.1",
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583429444
 
 
   Are you able to provide a sample reproduction app that contains a raw/pure cordova project (using no other frameworks) that demonstrates the issue?
   
   https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583050376
 
 
   Someone can help me, please?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583366712
 
 
   Hi, @breautek. Thanks for the help.
   
   It was an old version of `cordova-android` because it's a legacy code and some old devices was supported. Now the devices are at least at android 4.4.
   
   I updated the `cordova-android` version to `8.1.0` as sugested, but the error still the same. :(

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583395338
 
 
   I've trace where the `Invalid action` error comes from, and it appears to be coming from 
   
   ```java
   if (!wasValidAction) {
       PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
       callbackContext.sendPluginResult(cr);
   }
   ```
   
   https://github.com/apache/cordova-android/blob/c56cd4d5a8fdf2fc80ee8a9f1c960f21fca87a9a/framework/src/org/apache/cordova/PluginManager.java#L138-L141
   
   This essentially occurs when the javascript tries to call a native method that doesn't exist or the native object that you're calling doesn't respond to that particular action.
   
   Now I'm not sure why are you are hitting this condition but given that you said you just upgraded from version 1.x to 6.x, I have a feeling that something didn't update right...
   
   So here are the things I would try:
   
   First, I would confirm that you're on the latest version of `cordova` cli, (`cordova@9`).
   Next, since you're on cordova-android 8.1, I would try removing and reinstalling the file plugin.
   
   ```
   cordova plugin remove cordova-plugin-file
   cordova plugin add cordova-plugin-file
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] breautek commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583115887
 
 
   > Platform: Android@6.0.4
   
   Assuming this is `cordova-android` version, any reason why you are using such an old version of `cordova-android`? It's not supported due to it lacking support for target API 28 which is required by google to upload to the play store. The latest version is `8.1.0`.
   
   Upgrading from 6.x to 8.x may be breaking changes, but I'd strongly suggest you to upgrade, and if the issue persists then we can go from there.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583407454
 
 
   Here is the cordova version
   
   <img width="385" alt="Screen Shot 2020-02-07 at 11 11 19" src="https://user-images.githubusercontent.com/12296173/74036396-f60c1680-499a-11ea-98c9-aaad52a76696.png">
   
   I've deleted the platforms and plugins folder before and made all the process again. But, just to be clear, I did what you sugested and the error persists.
   
   <img width="624" alt="Screen Shot 2020-02-07 at 11 17 56" src="https://user-images.githubusercontent.com/12296173/74036692-82b6d480-499b-11ea-9943-23d27121d063.png">
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-583890103
 
 
   I will try soon

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 commented on issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 commented on issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375#issuecomment-594230022
 
 
   Hey, @breautek. How are you?
   
   Sorry for the delay.
   
   I finally tried to create an empty project and everything worked fine.
   
   Then, we decided to remove each import of .js files in the project to identify what was the problem.
   
   The problem was happening because back in the days the guys needed to implement a polyfil of the javascript native function `.bind()`.
   
   So, we removed that and the read operations worked like a charm.
   
   Thank you very much for the support.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[GitHub] [cordova-plugin-file] Gabrielr2508 closed issue #375: Uknown error on read a file

Posted by GitBox <gi...@apache.org>.
Gabrielr2508 closed issue #375: Uknown error on read a file
URL: https://github.com/apache/cordova-plugin-file/issues/375
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org