Closed benyaminl closed 7 months ago
Ah... the problem is the lib/querystring.js isn't initiated on edge runtime (https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation#importing-runtime-specific-code)
https://github.com/vercel/next.js/discussions/50198
:/
So I need to manually use the import() and doing by this way..
export async function register()
{
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import("./lib/rabbitmq").then(async (d) => {
await d.PubSub();
});
}
}
@benyaminl glad you got it sorted and thank you for posting the solution
Hello, I'm trying to use this client on nextjs, but I got error Module not found: Can't resolve 'querystring',
I'm using node 20 and nextjs 14
Error ⨯ ./node_modules/amqplib/lib/connect.js:10:0 Module not found: Can't resolve 'querystring'
I do check that Node 20 has querystring https://nodejs.org/docs/latest-v20.x/api/querystring.html
But why I got this error, it's what make me confused.
if is there any pointer regarding this, I would be thankful.