Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code: 'ERR_REQUIRE_ESM' #1505

Closed
ZONGMENG-kaito opened this issue Nov 7, 2024 · 13 comments · Fixed by #1506
Closed

code: 'ERR_REQUIRE_ESM' #1505

ZONGMENG-kaito opened this issue Nov 7, 2024 · 13 comments · Fixed by #1506
Assignees
Labels
lib/javascript JavaScript client library

Comments

@ZONGMENG-kaito
Copy link

Bug Report

I use svix in my npm project, but when I use the latest version, I got an error and the error code is code: 'ERR_REQUIRE_ESM'

Version

Latest version

Platform

Mac os

Description

I believe is because this dependency's upgrade: https://github.com/svix/svix-webhooks/blob/main/javascript/package.json#L32, upgrade to 2.0.0, which make the @stablelib/base64 to be ESM only: https://github.com/StableLib/stablelib/blob/master/packages/base64/package.json#L6

Image

@svix-onelson I likely found the upgrade PR was made from you, would you mind downgrading or fixing it? Thanks a lot.

@IbrahimMohammed47
Copy link

IbrahimMohammed47 commented Nov 7, 2024

Until they fix it, I found that version 1.37.0 is the latest one using @stablelib/base64 version 1
So you can use this in you package.json for now "svix": "~1.37.0" until we have a fix or you may want to migrate your project to be esm

@ZONGMENG-kaito
Copy link
Author

Until they fix it, I found that version 1.37.0 is the latest one using @stablelib/base64 version 1 So you can use this in you package.json for now "svix": "~1.37.0" until we have a fix or you may want to migrate your project to be esm

Thanks for your kinda reply, actually I am using this package: https://www.npmjs.com/package/@privy-io/server-auth which uses svix as a dep, so I finally got this error. I will try to modify my project to esm.

@tasn
Copy link
Member

tasn commented Nov 7, 2024

I wonder if we should just downgrade the base64 lib. Thanks for the report!

@ZONGMENG-kaito
Copy link
Author

I wonder if we should just downgrade the base64 lib. Thanks for the report!

Thanks, Tom, I strongly recommend that downgrade it to ^1.0.0, think this way. should be the easiest way to fix it?

@tasn
Copy link
Member

tasn commented Nov 7, 2024

Yeah, it's probably the right call (as long as there are no security issues or other incompatibilities). I wonder why upstream broke things this way. :|

@ZONGMENG-kaito
Copy link
Author

Yeah, it's probably the right call (as long as there are no security issues or other incompatibilities). I wonder why upstream broke things this way. :|

Hope to see a quick rollback version, :D.

@svix-onelson svix-onelson self-assigned this Nov 7, 2024
@svix-onelson svix-onelson added the lib/javascript JavaScript client library label Nov 7, 2024
svix-onelson added a commit that referenced this issue Nov 7, 2024
…1506)

Fixes #1505

Big thanks to @ZONGMENG-kaito for the report.

During the work on #1480
various dependencies were updated to match what is being produced by the
upstream code generator. Unfortunately, the version spec change for
`@stablelib/base64` up to 2.x means we inherit their ESM requirement.

The local tests (i.e. `SVIX_SERVER_URL=... SVIX_TOKEN=... yarn test`)
continue to pass with the downgrade, so it seems like pinning to 1.x
will free consumers of _our lib_ of this new requirement for now.

Hopefully in the future we'll find a way to track 2.x without
disruption.
@svix-onelson
Copy link
Contributor

Hi folks, the downgrade for @stablelib/base64 to the 1.x line landed moments ago. This should be resolved in the upcoming release.

@ZONGMENG-kaito
Copy link
Author

Hi folks, the downgrade for @stablelib/base64 to the 1.x line landed moments ago. This should be resolved in the upcoming release.

Thanks for your working, do we plan to release a new version shortly?

@svix-onelson
Copy link
Contributor

svix-onelson commented Nov 8, 2024

@ZONGMENG-kaito I anticipate a release tomorrow (Nov 8th).

@jsutaria
Copy link

@ZONGMENG-kaito I anticipate a release tomorrow (Nov 8th).

Any updates here?

@ZONGMENG-kaito
Copy link
Author

@ZONGMENG-kaito I anticipate a release tomorrow (Nov 8th).

Not yet, I will test it soon. Thanks for your work

@tasn
Copy link
Member

tasn commented Nov 12, 2024

There was a release already, did it not fix it for you?

@ZONGMENG-kaito
Copy link
Author

There was a release already, did it not fix it for you?

Yes, it's fixed now, big thanks to all of you.

didtheyghostme added a commit to didtheyghostme/didtheyghostme that referenced this issue Dec 6, 2024
Module not found: ESM packages (@stablelib/base64) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

error from svix webhook lib
svix/svix-webhooks#1505
didtheyghostme added a commit to didtheyghostme/didtheyghostme that referenced this issue Feb 19, 2025
Module not found: ESM packages (@stablelib/base64) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

error from svix webhook lib
svix/svix-webhooks#1505
didtheyghostme added a commit to didtheyghostme/didtheyghostme that referenced this issue Feb 21, 2025
Module not found: ESM packages (@stablelib/base64) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

error from svix webhook lib
svix/svix-webhooks#1505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib/javascript JavaScript client library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants