Can not get the readable electron crash reports on Sentry - electron

I'm handling crashes in our electron app with crashReporter and sending reports to sentry.io.
The goal is to see which part of JS caused the app to crash. To emulate crash I'm doing "process.crash()". To see source code trace I'm installing sentry from it's documentation, but source code never appears in sentry.
Here is the CrashReporter initialization code:
crashReporter.start({
companyName: '...',
productName: '...',
uploadToServer: true,
submitURL: 'https://....ingest.sentry.io/api/.../minidump/?sentry_key=...'
});
Sentry is added to project as:
sentry-wizard --integration electron
npm install --save-dev #sentry/cli electron-download
node sentry-symbols.js
Webpack config:
const SentryWebpackPlugin = require('#sentry/webpack-plugin');
var config = {
target: 'node',
devtool: 'source-map',
plugins: [
new webpack.ProgressPlugin(),
new webpack.EnvironmentPlugin(),
new SentryWebpackPlugin({
include: '.',
ignoreFile: '.sentrycliignore',
ignore: ['node_modules', 'webpack.config.js'],
configFile: 'sentry.properties'
})
],
...
But this is how it looks on sentry:

You are producing a native crash, what you see here is a C++ stack trace which is symbolicated. Try to throw new Error('test'); in JavaScript somewhere, then you should see a JS stack trace.

Related

Antd_dayjs_vite_plugin : TypeError: (0 , import_antd_dayjs_vite_plugin.default) is not a function

At the beginning I got a problem with the french date in the antd calendar. I use vite so I install the antd_dayjs_vite_plugin to switch from Moment.js to Day.js. It worked well but this morning the vite build process is in error. I tried to update the antd_dayjs_vite_plugin version (was 1.1.4) and now I got the same problem when I try to lunch a yarn dev as you can see :
$ yarn dev
yarn run v1.22.15
$ vite
failed to load config from vite.config.ts
error when starting dev server:
TypeError: (0 , import_antd_dayjs_vite_plugin.default) is not a function [...]
Here is the code in vite.config.ts :
import reactRefresh from '#vitejs/plugin-react-refresh';
import antdDayjs from 'antd-dayjs-vite-plugin';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh(), antdDayjs()],
server: {
host: process.env.HOST || '127.0.0.1',
},
resolve: {
alias: [{ find: '#', replacement: '/src' }],
},
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
});
The problem also appears in antd-dayjs-vite-plugin 1.1.4 version or the 1.2.2. I also already tried to update vite to 3.1 (was in 2.5).
I don't understand the code seems to be exactly the same as the usage in the Readme package.
Thanks in advance for your help. 🙏🏻
Seams that a default export is expected by vite.js (tried to replace import statement with import {antdDayjs} from 'antd-dayjs-vite-plugin'; without success)
I was able to create a workaround using patch-package with the below steps:
modifiy node_modules/antd-dayjs-vite-plugin/dist-node/index.js
at the very end of that file, add exports.default = antdDayjs;
create a patch for antd-dayjs-vite-plugin
ensure you have the postinstall script (refer to patch-package doc)

Rollup configuring alias for semantic-ui-less #import

I have been configuring rollup for creating custom react component library on top of fomantic-ui.
I have already setup the rollup.config.js
ALthough in the configuration, I need to resolve an import:
#import (multiple) '../../theme.config';
the import is part of fomantic-ui-less library, which needs to be resovled to:
path.join(__dirname, '/themes/theme.config')
and I do have themes/theme.config at my project root.
when I run build command it throws following error:
[!] (plugin postcss) Error: '../../theme.config' wasn't found. Tried - E:\Projects\UILibrary\node_modules\fomantic-ui-less\theme.config,..\..\theme.config
and I have used the rollup-plugin-postcss plugin and #rollup/plugin-alias, and called it inside plugins array
...
plugins: [
...
alias({
entries: [
find: '../../theme.config$',
replacement: path.join(__dirname, '/themes/theme.config')
]
})
postcss(),
...
]
I have also tried changing the order of plugins.
And the worst part is, it is working when configuring the storybook, using webpack alias.
.storybook/main.js
webpackFinal: async (config) => {
config.resolve.alias = {
"../../theme.config$": path.join(__dirname, "../themes/theme.config")
}
...
}

Connection refused when launching Electron app generated with electron-packager/ electron-builder

I have a React Electron app with Webpack and try to build it into an executable.
I used the CLI commands of electron-packager and electron-builder which ran without errors.
But when I run the exe I get a blank screen and from terminal the error message:
(node:8172) electron: Failed to load URL: http://localhost:3000/main_window with error: ERR_CONNECTION_REFUSED
(Use mixmatch --trace-warnings ... to show where the warning was created)
Running with the option doesn't give any additional information.
Searching the source code for localhost leads to index.js in the webpack directory:
var createWindow = function () {
var preload = path_1.default.join(__dirname, '../renderer/main_window', "preload.js");
exports.mainWindow = new electron_1.BrowserWindow({
// show: false,
webPreferences: {
enableRemoteModule: false,
// nodeIntegration: false, // is default value after Electron v5
preload: preload // use a preload script
}
});
exports.mainWindow.loadURL('http://localhost:3000/main_window');
exports.mainWindow.maximize();
exports.mainWindow.webContents.openDevTools();
};
So I guess a server is being started, which probably is the same for every app, but the app is not allowed to access localhost.
So why does it seem to work easily for everyone else but not for me?
Once the build is created, you need to loadURL from build/index.html.
Replace your code of export.mainWindow.loadURL with this
e.g.
const isDev = require('electron-is-dev');
exports.mainWindow.loadURL(
isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../build/index.html')}`
);

Intern 3.4 on IOS safari

When I try to execute intern script on ios simulator, safari window launches out side of simulator and opens page let's browse and further script will never execute.
this is happening for all simulators?
This was working previously, but I played little with npm install ios-deploy, tried to install it and remove it.
but since then it stopped working.
And could can anyone please tell me the need of ios-deploy in case of executing intern script on ios simulator.
I have tried shutdown erase of ios simulator and ios deploy
Sample intern.js file `define({
defaultTimeout: 900000,
reporters: [{id: 'LcovHtml', directory: 'InternHTMLResult'}, {id: 'Console'}],
  environments: [
        { platformName: 'iOS',
            deviceName: 'iPhone 6', // for example
           bundleId: 'com.apple.mobilesafari', // for example
            automationName: 'XCUITest',
browserName: 'safari',
//platformVersion: '10.3', // for example
Simulator: true,
            fixSessionCapabilities: false
      }
    ],
maxConcurrency: 5,
tunnel: 'NullTunnel',
tunnelOptions : {
port: Number('4723')
},
functionalSuites: ['tests/functional/3DExpLogin1.js'],
excludeInstrumentation: true
// excludeInstrumentation: /^(?:node_modules)//
});
`

Ionic App - SQLite error "plugin_not_installed" only when running app in iOs devices

I builded an hybrid app using Ionic3+AngularJS and it uses the SQLite database.
When I run the app in Android's devices it works perfectly but when I try to run it in an iPhone or iPad I get the following error: plugin_not_installed. It happens when the app tries to create the database.
This is how it's creating the database:
public getDB(){
return this.sqlite.create({
name: 'namedatabase.db',
location: 'default'
}).catch( error => this.showError(error));
}
The catch() is called and it shows the error message "plugin_not_installed".
SQLite installed using:
$ ionic cordova plugin add cordova-sqlite-storage
$ npm install --save #ionic-native/sqlite
Any ideas?
I'm getting the same issue when I run my app in an android emulator using
ionic cordova run android -lc
When the app start, everything is ok. But after a couple of changes in my code and a save command, the app reload and show in my console
console.warn: Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins / and reinstalling them.
console.warn: 'Native: tried accessing the SQLite plugin but it's not installed.
console.warn: Install the SQLite plugin: 'ionic cordova plugin add cordova-sqlite-storage'
console.log: err "plugin_not_installed"
Even if I followed what the console asked me to do, I'm still getting the same error and it cannot create my SQLite database
What I did next is to re-run the app using the run command above, but it waste a lot of time for me to wait for the app to get started again... and again :(
createDBFile() {
this.sqlite.create({
name: DB_NAME,
location: 'default'
}).then((db: SQLiteObject) => {
this.db = db;
console.log('BDD cree')
this.stockageLocal.get('dbstatus').then(opened => {
if (opened) {
console.log('DB deja ouvert');
}
else {
console.log('create all table')
this.createTables();
}
})
}).catch(err => {
console.log(' err', JSON.stringify(err))
});
}
I had the same problem: plugin_not_installed.
I resolved putting console.log check after the promise errors and seeing that the table didn't exist.
The code:
this.sqlite.create({
name: 'ionicdb.db',
location: 'default'
})
.then((db: SQLiteObject) => {
db.executeSql('create table if not exists MY_SQLITE_STORAGE(key VARCHAR(32) PRIMARY KEY, value VARCHAR(32))', [])
.then(() => {
console.log('Executed Create table if not exists');
this.toastCtrl.create({
message: 'Table created ',
duration: 5000,
position: 'center'
}).present();
}).catch(e => console.log('error: '+JSON.stringify(e)));
}).catch(e => console.log('error: '+JSON.stringify(e)));

Resources