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.

TypeError: Cannot read property 'bind' of undefined

See original GitHub issue

Error: Cant able to build my app, but works normally in development mode Tried to downgrade to v2.1.1

framework: Gatsby

To reproduce: gatsby build

jsPDF version: 2.2.0

error snapshot:

* @license
  80 |  * FPDF is released under a permissive license: there is no usage restriction.


  WebpackError: TypeError: Cannot read property 'bind' of undefined
  
  - jspdf.es.min.js:77 
    node_modules/jspdf/dist/jspdf.es.min.js:77:2920
  
  - header.tsx:1 
    src/components/header.tsx:1:1
  
  - layout.tsx:1 
    src/components/layout.tsx:1:1
  
  - 404.js:1 
    src/pages/404.js:1:1

Any solution?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
RajeshKumarScommented, Sep 1, 2021

As of now I have overcome this issue using a dynamic import if window is defined:

import('jspdf').then(jspdf => {
  const doc = new jspdf.jsPDF(...);
  ...
})

It is adequate for my use case.

2reactions
pepijn-vanvlaanderencommented, Aug 27, 2021

For other Gatsby users, this can be resolved by including the polyfills in the SSR config of Gatsby:

#gatsby-ssr.js
require('jspdf/dist/polyfills.es')
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'bind' of undefined. React.js [duplicate]
this is my code. I'd like to call handlechanged method from input item. But then, Cannot read property 'bind' of undefined is raised....
Read more >
TypeError: Cannot read property 'bind' of undefined ... - GitHub
Description. Receiving the error "Type Error: Cannot read property 'bind' of undefined". The offending line is in react-native\Libraries ...
Read more >
TypeError: Cannot read property 'bind' of undefined - Reddit
Problem 1: You bound non-existent handleChange and handleSubmit methods to the class without defining either method. Problem 2: Without defining ...
Read more >
TypeError: Cannot read property 'bind' of undefined - Odoo
Traceback: TypeError: Cannot read property 'bind' of undefined at http://localhost:8069/web_editor/static/src/js/wysiwyg/root.js:46:57 at Function._.each._.
Read more >
Scheduler - The 'Cannot read property 'bind' of undefined ...
This error is shown in the console when I switch to agenda view: ERROR TypeError: Cannot read property 'bind' of undefined at inheritor....
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