-
Notifications
You must be signed in to change notification settings - Fork 116
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
Can't resolve 'bufferutil' and 'utf-8-validate' #179
Comments
This can be solved by configuring your webpack externals: //webpack.functions.js
const nodeExternals = require('webpack-node-externals');
module.exports = {
externals: [nodeExternals()],
}; However, imho it is more reasonable to have this set up by default so there's no hassle with a custom webpack config when setting up a graphql lambda. @sw-yx Any thoughts or objections on having this config by default? I'd be happy to open a PR adding it! |
One thing I forgot to note, you'll also have to point to your config file in the netlify-lambda build src/lambda --config webpack.functions.js |
Thanks so much for this! |
If you facing this problem with Next.JS, you just need to add isServer condition for it gonna work
|
hi there , could u public your file , i have problem with nextjs |
@dquanghuy4444 I cant do it because of NDA, sorry. You can just show your config |
thank bro , i install fabricjs (https://www.npmjs.com/package/fabric) , and deploy nextjs by netlify and i have this error My next.config.js
|
The solution for me was add this ti my
I'm using Next 12.1.5 |
# netlify.toml
[functions]
included_files = [
# For some reason this works to fix "bufferutil" error on
# Netlify Function and external_node_modules does not
"node_modules/bufferutil/**",
"node_modules/utf-8-validate/**"
] |
|
next version 13.4.7
// next.config.js
|
I have no idea what those packages are used for. Can someone clarify it please? And my another concern is that don't we need those packages in production as we are installing with dev flag? Is not that something Nextjs needs to handle internally for their config? |
when you try to use `@web3-storage/access` in a new next.js repository you get errors like this: ``` Import trace for requested module: ./node_modules/ipfs-utils/src/http/fetch.js ./node_modules/@web3-storage/upload-client/src/store.js ./node_modules/@web3-storage/upload-client/src/index.js ./node_modules/@web3-storage/w3up-client/src/client.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ./node_modules/ws/lib/buffer-util.js Module not found: Can't resolve 'bufferutil' in '/Users/travis/dev/pl/sample-w3/node_modules/ws/lib' Import trace for requested module: ./node_modules/ws/lib/buffer-util.js ./node_modules/ws/lib/websocket.js ./node_modules/ws/index.js ./node_modules/isomorphic-ws/node.js ./node_modules/@web3-storage/access/src/utils/ws.js ./node_modules/@web3-storage/access/src/agent-use-cases.js ./node_modules/@web3-storage/access/src/agent.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ./node_modules/ws/lib/validation.js Module not found: Can't resolve 'utf-8-validate' in '/Users/travis/dev/pl/sample-w3/node_modules/ws/lib' Import trace for requested module: ./node_modules/ws/lib/validation.js ./node_modules/ws/lib/receiver.js ./node_modules/ws/index.js ./node_modules/isomorphic-ws/node.js ./node_modules/@web3-storage/access/src/utils/ws.js ./node_modules/@web3-storage/access/src/agent-use-cases.js ./node_modules/@web3-storage/access/src/agent.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ``` Which looks like the same thing as netlify/netlify-lambda#179 and shows up a few other times in similar repos. While we could instruct our users to add some build configuration to go away, we don't use websockets in production in any of our flows and imho we should just remove this dependency. The easiest way to do this is to remove the cli as well, and since we don't use that anywhere that also seems like a good idea.
when you try to use `@web3-storage/access` in a new next.js repository you get errors like this: ``` Import trace for requested module: ./node_modules/ipfs-utils/src/http/fetch.js ./node_modules/@web3-storage/upload-client/src/store.js ./node_modules/@web3-storage/upload-client/src/index.js ./node_modules/@web3-storage/w3up-client/src/client.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ./node_modules/ws/lib/buffer-util.js Module not found: Can't resolve 'bufferutil' in '/Users/travis/dev/pl/sample-w3/node_modules/ws/lib' Import trace for requested module: ./node_modules/ws/lib/buffer-util.js ./node_modules/ws/lib/websocket.js ./node_modules/ws/index.js ./node_modules/isomorphic-ws/node.js ./node_modules/@web3-storage/access/src/utils/ws.js ./node_modules/@web3-storage/access/src/agent-use-cases.js ./node_modules/@web3-storage/access/src/agent.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ./node_modules/ws/lib/validation.js Module not found: Can't resolve 'utf-8-validate' in '/Users/travis/dev/pl/sample-w3/node_modules/ws/lib' Import trace for requested module: ./node_modules/ws/lib/validation.js ./node_modules/ws/lib/receiver.js ./node_modules/ws/index.js ./node_modules/isomorphic-ws/node.js ./node_modules/@web3-storage/access/src/utils/ws.js ./node_modules/@web3-storage/access/src/agent-use-cases.js ./node_modules/@web3-storage/access/src/agent.js ./node_modules/@web3-storage/w3up-client/src/index.node.js ./app/utils/utils.ts ./app/page.tsx ``` Which looks like the same thing as netlify/netlify-lambda#179 and shows up a few other times in similar repos. While we could instruct our users to add some build configuration to go away, we don't use websockets in production in any of our flows and imho we should just remove this dependency. The easiest way to do this is to remove the cli as well, and since we don't use that anywhere that also seems like a good idea.
what is for nuxt ? |
I solved this by adding the following nodeLinker: pnp
pnpMode: loose |
on
netlify-lambda build
Despite those errors, ./netlify/functions/graphql still works locally after running
netlify-lambda serve
The repo I'm having this issue in is also the mininal reproduction https://github.com/NickyMeuleman/jason-api
The text was updated successfully, but these errors were encountered: