eclipsesource / tabris-js

Create native mobile apps in JavaScript or TypeScript.
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
1.4k stars 170 forks source link

Fetch api success on tabris test program but production aab/apk is not work #2254

Open nozomi199 opened 1 year ago

nozomi199 commented 1 year ago

Dear all,

I have a javascript file that is load from outside, and pass it to Module.execute I have tested on tabris.js dev/test program, but the same code is not work on my built file. Would you have any idea to check and solve the problem, thanks for your help.

I'm using tabris 3.9 and the sample code is pasted below:

const {contentView, TextView, Module} = require('tabris');
async function main() {
    var url = 'https://some-valid.dummy/main.js';
    var a = await fetch(url);
    var b = await a.text();
    try {
        Module.execute(b, url);
    }catch(e) {
    }
}

main().catch(function(e) {
    //nothing to do
    new TextView({
        text:"Error",
        centerX: '0',
        centerY: '0',
        font: '36px',
    }).appendTo(contentView);
})

cheers,

Alan (a.k.a. summer)

cookieguru commented 1 year ago

What output or errors do you see? What output are you expecting?

nozomi199 commented 1 year ago

Dear cookieguru,

I'm expected my app script is loaded from internet and executed correctly with UI. For example, I have a example script with one TextView and append it to contentView, after loaded, the apps will be shown the TextView with text. But error occured.

I have traced the script. And found out the following exeption: TypeError: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. TypeError: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. at HttpRequest. (./node_modules/tabris/tabris.min.js:1:246263) at notifyCallback (./node_modules/tabris/tabris.min.js:1:29231) at HttpRequest.[notify] (./node_modules/tabris/tabris.min.js:1:28354) at HttpRequest.$trigger (./node_modules/tabris/tabris.min.js:1:74212) at HttpRequest._trigger (./node_modules/tabris/tabris.min.js:1:74161) at Tabris._notify (./node_modules/tabris/tabris.min.js:1:86359)

And build script is using "tabris-connect-migration-guide" and built in github https://github.com/eclipsesource/tabris-connect-migration-guide

cheers, Alan (a.k.a summer)

cookieguru commented 1 year ago

The message Trust anchor for certification path not found means there is a problem with your server configuration. You can see this post for more details. Also try opening the same URL in a web browser to see if there are still errors.

You can try using this URL, which is also https https://pastebin.com/raw/rFZUyMbZ