Comments (15)
Nextjs doesn't load proto files by default, you should modify webpack config: copy these file into the build folder.
This config works for me.
const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer }) => {
if (isServer) {
// Copy the proto files to the server build directory
config.plugins.push(
new CopyWebpackPlugin({
patterns: [
{
from: path.join(
__dirname,
"node_modules/@zilliz/milvus2-sdk-node/dist"
),
to: path.join(__dirname, ".next"),
},
],
})
);
}
// Important: return the modified config
return config;
},
};
module.exports = nextConfig;
from milvus-sdk-node.
Let me do some test.
from milvus-sdk-node.
Would you like to share you code?
from milvus-sdk-node.
I have the same issue, running on vercel, sveltekit setup.
"@zilliz/milvus2-sdk-node": "^2.2.10",
relevant code 👇
`
import { DataType, MilvusClient } from '@zilliz/milvus2-sdk-node';
const client = new MilvusClient(address, secure, user, password);
const collection_name = 'foobar';
await client.loadCollectionSync({
collection_name
});
const vector = [...Array(512)].map(() => Math.random());
const res = await client.search({
collection_name,
vectors: [vector],
search_params: {
anns_field: "vector",
metric_type: "L2",
params: JSON.stringify({ nprobe: 64 }),
topk: '5',
},
output_fields: ['baz'],
vector_type: DataType.FloatVector,
});
`
from milvus-sdk-node.
vercel
Thanks. maybe there is some limitation on vercel platform. let me test it.
from milvus-sdk-node.
it's the same for lower vector dims like 128
from milvus-sdk-node.
It breaks on Netlify as well, edge function related maybe.
from milvus-sdk-node.
Nextjs 默认不加载 proto 文件,你应该修改 webpack 配置:将这些文件复制到构建文件夹中。
这个配置对我有用。
const path = require("path"); const CopyWebpackPlugin = require("copy-webpack-plugin"); /** @type {import('next').NextConfig} */ const nextConfig = { webpack: (config, { isServer }) => { if (isServer) { // Copy the proto files to the server build directory config.plugins.push( new CopyWebpackPlugin({ patterns: [ { from: path.join( __dirname, "node_modules/@zilliz/milvus2-sdk-node/dist" ), to: path.join(__dirname, ".next"), }, ], }) ); } // Important: return the modified config return config; }, }; module.exports = nextConfig;
👋 我也碰到了类似的问题:ENOENT: no such file or directory, open 'C:/Users/Administrator/Desktop/official-website/.next/server/app/proto/proto/schema.proto',你这个方案貌似解决了我的问题,棒棒哒🤣
from milvus-sdk-node.
Can the protoPath variable be configured? From the code, it seems to use __dirname, which would cause the protoPath to constantly change by caller route in Next.js, making it more troublesome to use.
from milvus-sdk-node.
Or make it nextjs-milvus
Or is prisma-milvus
from milvus-sdk-node.
v2.3.0 works like a charm. Thanks @shanghaikid
from milvus-sdk-node.
Hello,
I have the some problem with Nuxt3 when build app.
Package version : @zilliz/milvus2-sdk-node": "^2.3.1"
Error message:
unresolvable extensions: 'extend google.protobuf.FileOptions' in .milvus.proto.milvus
at Root.resolveAll (//.output/server/node_modules/protobufjs/src/root.js:256:15)
at loadProtosWithOptionsSync (//.output/server/node_modules/@grpc/proto-loader/build/src/util.js:68:16)
at loadSync (//.output/server/node_modules/@grpc/proto-loader/build/src/index.js:197:61)
from milvus-sdk-node.
Nextjs doesn't load proto files by default, you should modify webpack config: copy these file into the build folder.
This config works for me.
const path = require("path"); const CopyWebpackPlugin = require("copy-webpack-plugin"); /** @type {import('next').NextConfig} */ const nextConfig = { webpack: (config, { isServer }) => { if (isServer) { // Copy the proto files to the server build directory config.plugins.push( new CopyWebpackPlugin({ patterns: [ { from: path.join( __dirname, "node_modules/@zilliz/milvus2-sdk-node/dist" ), to: path.join(__dirname, ".next"), }, ], }) ); } // Important: return the modified config return config; }, }; module.exports = nextConfig;
so this problem can not resolve? I think copy-webpack
is a dirty code for me.
from milvus-sdk-node.
Nextjs doesn't load proto files by default, you should modify webpack config: copy these file into the build folder.
This config works for me.const path = require("path"); const CopyWebpackPlugin = require("copy-webpack-plugin"); /** @type {import('next').NextConfig} */ const nextConfig = { webpack: (config, { isServer }) => { if (isServer) { // Copy the proto files to the server build directory config.plugins.push( new CopyWebpackPlugin({ patterns: [ { from: path.join( __dirname, "node_modules/@zilliz/milvus2-sdk-node/dist" ), to: path.join(__dirname, ".next"), }, ], }) ); } // Important: return the modified config return config; }, }; module.exports = nextConfig;so this problem can not resolve? I think
copy-webpack
is a dirty code for me.
You can define the milvus proto file in the clientOptions. or you can create a pr to make it better.
from milvus-sdk-node.
Hey @shanghaikid .
I managed to run nextjs with your solution but just on "npm run dev"(when changing to what you said) but when I'm doing npm run build I get this error:
Collecting page data ..Error: Unable to load service: milvus.proto.milvus.MilvusService from XXXXXX/.next/proto/proto/milvus.proto but the file exists in the direcoty
from milvus-sdk-node.
Related Issues (20)
- Uncaught exception: write EPIPE HOT 3
- useDatabase is not available HOT 1
- getVersion Should be removed from API? HOT 1
- Ignore Growing Segment
- Delete is not working, Delete entities not working HOT 9
- Provide a count function HOT 4
- Can not work on `grpc/grpc-js: 1.8.19` default dependency HOT 3
- `milvusClient.delete()` can not delete entities when the primary key is string.
- Fail to run langchain milvus vector store sample HOT 9
- Lack of error handling on invalid collection names
- output_fields error
- search api only return `score` and `id` HOT 7
- It should handle int64 properly
- support missing AlterCollection
- failed to get channels, collection not loaded HOT 3
- MilvusClient instantiation is not catchable HOT 1
- The dynamicSchema in the example is OK? HOT 2
- Please support search for multiple vectors HOT 2
- [Langchain] - How to set collection vector dimension? HOT 2
- Build a pool of connections <> Check if the connection is dead to revive it. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milvus-sdk-node.