You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "besscroft (via GitHub)" <gi...@apache.org> on 2025/05/30 08:37:31 UTC
[I] bug: es module not support [opendal]
besscroft opened a new issue, #6237:
URL: https://github.com/apache/opendal/issues/6237
### Describe the bug
I'm encountering issues using Opendal in Next.js after importing it.

bindings-nodejs is a CommonJS project and needs to be adapted before it can be used in ES Module. Or change the way use it.
### Steps to Reproduce
- code example
```ts
import 'server-only'
import { Operator } from 'opendal'
let s3Operator: Operator | null = null
export async function getS3Operator(findConfig: Config[]) {
if (!findConfig.length) {
console.warn('s3 init error')
}
if (s3Operator) return s3Operator
s3Operator = new Operator('s3', {
bucket: bucket,
region: region,
endpoint: endpoint,
access_key_id: accesskeyId,
secret_access_key: accesskeySecret,
})
return s3Operator
}
```
### Expected Behavior
It should work fine. I was able to get it to work properly with `next dev --turbopack` after modifying some of the source code. I'm not sure if it complies with the spec, and there are some other issues that may be worth discussing.
### Additional Context
Two questions:
- Nextjs seems to parse the package incorrectly, causing esm to be unable to load dependencies normally.
- Regarding the opendal.xxx.node file, nextjs itself is not adapted and needs to be configured in next.config. [serverExternalPackages](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages)
> I would like to add the separate configuration required for nextjs to use opendal in the document to facilitate other people's use.
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #6237: bug: es module not support
URL: https://github.com/apache/opendal/issues/6237
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "npv2k1 (via GitHub)" <gi...@apache.org>.
npv2k1 commented on issue #6237:
URL: https://github.com/apache/opendal/issues/6237#issuecomment-2933714355
same issure when use opendal version 0.48.3 on nestjs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "GeorgeDong32 (via GitHub)" <gi...@apache.org>.
GeorgeDong32 commented on issue #6237:
URL: https://github.com/apache/opendal/issues/6237#issuecomment-2935214714
The same issue exists when using Node.js. Downgrading to version 0.47.11 can temporarily resolve it. Looking forward to further fixes, and thank you all for your efforts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "besscroft (via GitHub)" <gi...@apache.org>.
besscroft commented on issue #6237:
URL: https://github.com/apache/opendal/issues/6237#issuecomment-2933870575
Hi, @Xuanwo, I'm happy to contribute with a pull request. After modifying part of the source code and adjusting the Next.js configuration, `next dev --turbopack` is now running properly. Currently, there are still some issues with `next build` and `next build --turbopack`, but after analysis, it seems unrelated to OpenDAL and is more of a Next.js problem. I'll continue testing after work today, and if everything goes well, I'll submit a PR!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #6237:
URL: https://github.com/apache/opendal/issues/6237#issuecomment-2933762789
Hi, @besscroft would you like to prepare a PR for this? I'm willing to merge this if it can remove blockers for our users.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: es module not support [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #6237:
URL: https://github.com/apache/opendal/issues/6237#issuecomment-2934260494
> Hi, [@Xuanwo](https://github.com/Xuanwo), I'm happy to contribute with a pull request. After modifying part of the source code and adjusting the Next.js configuration, `next dev --turbopack` is now running properly. Currently, there are still some issues with `next build` and `next build --turbopack`, but after analysis, it seems unrelated to OpenDAL and is more of a Next.js problem. I'll continue testing after work today, and if everything goes well, I'll submit a PR!
That's great!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org