lmsqueezy/lemonsqueezy.js

Error in window.createLemonSqueezy()

Closed this issue · 8 comments

I downloaded the Lemon Squeezy Next JS billing repo. Everything work perfectly, but I get this error when I run the app it says TypeError: window.createLemonSqueezy is not a function

The error is in /components/plan.jsx

How can I fix this error?

Screenshot 2024-02-04 at 7 00 30 PM

I got weird problems in incognito mode with this were lemonsqueezy doesn't load

Are you inserting <script src="https://app.lemonsqueezy.com/js/lemon.js" defer /> in index.js (or layout.js for Next)?

Temporarily I fixed it like this:

useEffect(() => {
setTimeout(() => {
// @ts-ignore
window.createLemonSqueezy();
}, 500);
}, []);

Are you using a framework or vanilla html and js?

The reason why you haven't received an official response from lemon squeezy is probably because there's not enough information in your issue. If you copy and paste all your code, someone will be able to point you in the right direction.

The maintainers also often ask for the ability to reproduce your error, so either creating an repo with all your code (or the relevant parts) or copy and pasting your code is required.

Also, if you feel like you fixed the issue, be sure to close the issue below, so it's not persisting as an open issue.

Here's a related issue: #55

There's another npm package for client side. The one you're using, according to the other thread, was created for server side calls to the lemon squeezy API