在 node.js 中有一个用于连接到 Datastax Astra-DB Cassandra 数据库的驱动程序,称为“cassandra-driver”。对于传统连接,它使用名为 secure-connect-{DB-Name}.zip 的连接密钥文件,语法如下:
const client = new Client({
cloud: {
secureConnectBundle: 'Address of the zipped file'
},
credentials: {
username: 'This is client_id',
password: 'This is client_secret',
},
});
在本地,语法运行良好,但当我将其部署在 AWS Amplify 上时,由于文件未放入 Next.js 包中,将引发文件未找到错误。现在的问题是:有没有办法将文件保存在 Next.js 包中的 Amplify 本身,而不是将其上传到外部存储(如 S3,一种愚蠢的方式!)来访问?
我遇到了同样的问题,在我的例子中是将它部署到 Vercel。问题可以这样解决,
const client = new Client({
cloud: {
secureConnectBundle: path.join(
process.cwd(),
"filename.zip"
)
},
credentials: {
username: 'This is client_id',
password: 'This is client_secret',
},
});
如果这对你有用,请告诉我