-
Notifications
You must be signed in to change notification settings - Fork 54
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
[Bug]: Cannot instantiate new EasyPostClient in Nextjs 13 #439
Comments
Hello @oliviergabison , thanks for reaching out and reporting this! We are currently investigating the issue, and will keep you updated. |
Hello @oliviergabison , just wanted to update you on our findings so far. We've been able to recreate your issue trying to import the library into a Next.js 13 project, and have discovered the issue lies in the In our research, we came across another library that seems to be facing a similar issue, if any of the conversation there might be able to help you get unblocked: pubnub/javascript#352. In the meantime, we'll continue investigating if there's anything we need/can fix with our library specifically. Thanks again for reporting this! |
I'm running into this as well |
Ok, I think I finally found the issue. It is definitely a common issue with formidable + webpack
That last pull request actually provides a solution though. In the diff, in the Next.js config, you can see they create a webpack override for it. I did that as well, and it fixed the issue for me.
import webpack from "webpack";
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/^hexoid$/,
"hexoid/dist/index.js"
)
);
return config;
},
};
export default nextConfig; |
@oliviergabison @jonknyc, did the override suggestion above help in your cases? |
I ended up just calling the API with fetch, instead of using the SDK. e.g.
|
Software Version
7.2.0
Language Version
20.10.0
Operating System
Mac OS 13.3.1
What happened?
const client = new EasyPostClient(process.env.EASYPOST_API_KEY!);
.TypeError: a is not a function
What was expected?
To be able to build the app while using EasyPostClient
Sample Code
Relevant logs
No response
The text was updated successfully, but these errors were encountered: