question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Cannot read property 'getAppPath' of undefined

See original GitHub issue

Versions + Platform

  • SDK version - @sentry/electron@v1.5.1
  • Electron version - electron@v7.2.4
  • Platform - Windows

Description

I updated from 0.17.0 to 1.5.1, and I now see this error:

Uncaught TypeError: Cannot read property 'getAppPath' of undefined
    at eval (webpack-internal:///./app/node_modules/@sentry/electron/esm/main/normalize.js:8)
    at Module../app/node_modules/@sentry/electron/esm/main/normalize.js (renderer.js:1907)
    at __webpack_require__ (renderer.js:750)
    at fn (renderer.js:61)
    at eval (webpack-internal:///./app/node_modules/@sentry/electron/esm/main/backend.js:15)
    at Module../app/node_modules/@sentry/electron/esm/main/backend.js (renderer.js:1811)
    at __webpack_require__ (renderer.js:750)
    at fn (renderer.js:61)
    at eval (webpack-internal:///./app/node_modules/@sentry/electron/esm/main/client.js:8)
    at Module../app/node_modules/@sentry/electron/esm/main/client.js (renderer.js:1823)

I found a couple of issues (https://github.com/getsentry/sentry-electron/issues/92, https://github.com/getsentry/sentry-electron/issues/142) that reference this error, though they seem to be focused on different errors. I tried the deep import mentioned here, to no avail.

This was working with no issues previously, and the only change I made was to update to 1.5.1. I didn’t see any breaking changes that suggest a problem in this area.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
timfishcommented, May 26, 2021

Yep, this will be the cause. You’re telling webpack that your renderer is a node process and this means it’ll look at the main field in package.json which points at the code for the Electron main process.

In the renderer you’re going to have to import the esm build manually. I’ve not actually tried this myself, but It’ll be something like this:

import { init } from '@sentry/electron/esm/renderer'

init({})
0reactions
timfishcommented, Oct 11, 2021

Link fixed.

I’ve opened a new issue for errors missing from the preload context: #372

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'getAppPath' of undefined
The issue is that electron is giving a error when it is trying to access the appPath() method. This same code works elsewhere...
Read more >
TypeError: Cannot read property 'getAppPath' of undefined ...
I want to test my Electron app with spectron, when I require a model "Record" defined by my self, I get an error:...
Read more >
electron.App.getAppPath JavaScript and Node.js ... - Tabnine
Best JavaScript code snippets using electron.App.getAppPath(Showing top 12 results out of 315) · main.js/ipcMain.on · app/modules/views.js/undefined/load · main.js ...
Read more >
[Electron Quick Start Issue] TypeError: Cannot read property ...
I was following Writing Your First Electron App https://electronjs.org/docs/tutorial/first-app I got the error as titled. I searched and a solution is found ...
Read more >
cannot read properties of undefined (reading 'ipcrenderer')
I'm trying to set up some cookies for my electron application but when the code on the function below executes, this error comes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found