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.

Error: Cannot read properties of undefined (reading 'toDataURL') at t.default._setupIcon

See original GitHub issue

Describe the bug When using the package, it is firing the following error message on preload.ts:

Uncaught TypeError: Cannot read properties of undefined (reading 'toDataURL') at t.default._setupIcon

To Reproduce Steps to reproduce the behavior:

  1. Create a new electron + typescript project following this template: https://github.com/Deluze/electron-vue-template
  2. Follow the instructions to setup custom-electron-titlebar
  3. Add the following declaration to a .d.ts file to enable importing custom-electron-titlebar
declare module "custom-electron-titlebar/main" {
  import type cetMain from "custom-electron-titlebar/dist/main/main";
  
  export const setupTitlebar: typeof cetMain.setupTitlebar;
  export const attachTitlebarToWindow: typeof cetMain.attachTitlebarToWindow;
}
  1. See the error in the console

Expected behavior The expected behavior is to show the title bar

Screenshots image

Desktop:

  • OS: Windows 11
  • Electron version: 20.1.0
  • Node Version: 16.13

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexTorresDevcommented, Oct 13, 2022

Working on it

0reactions
AlexTorresDevcommented, Nov 5, 2022

Describe the bug When using the package, it is firing the following error message on preload.ts:

Uncaught TypeError: Cannot read properties of undefined (reading 'toDataURL') at t.default._setupIcon

To Reproduce Steps to reproduce the behavior:

  1. Create a new electron + typescript project following this template: https://github.com/Deluze/electron-vue-template
  2. Follow the instructions to setup custom-electron-titlebar
  3. Add the following declaration to a .d.ts file to enable importing custom-electron-titlebar
declare module "custom-electron-titlebar/main" {
  import type cetMain from "custom-electron-titlebar/dist/main/main";
  
  export const setupTitlebar: typeof cetMain.setupTitlebar;
  export const attachTitlebarToWindow: typeof cetMain.attachTitlebarToWindow;
}
  1. See the error in the console

Expected behavior The expected behavior is to show the title bar

Screenshots image

Desktop:

  • OS: Windows 11
  • Electron version: 20.1.0
  • Node Version: 16.13

This bug was fixed in the clean code branch. In the next few weeks a beta will be released and in the next month the stable version. 🚀🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property toDataURL of undefined - Stack Overflow
Your code reads like this var ctx = document.createElement("canvas"); var ctx1 = ctx.getContext("2d"); var asd = convertCanvasToImage(ctx1) ...
Read more >
TypeError: Cannot read property 'toDataURL' of undefined ...
In a TS file ISSUE import qrcode from 'qrcode'; const result = qrcode.toDataURL('xxxx') throw error TypeError: Cannot read property 'toDataURL' of undefined ...
Read more >
ERROR TypeError: Cannot read property title of undefined
Your browser can' t play this video. Learn more. Switch camera ... Solved: ERROR TypeError : Cannot read property title of undefined.
Read more >
Cannot read properties of undefined' - JavaScript Debugging
How To Fix 'Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging.
Read more >
Can Not Read Properties of Undefined Reading Map in React ...
If you are looking at can not read properties of undefined reading map in react js error or map function is not displaying...
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