-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
本地运行插件报错 #1008
Comments
👀 @lihui123456 Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
|
有截图吗? |
Are there any screenshots? |
@lobehubbot 截图如上图所示 |
@lobehubbot screenshot is shown above |
本地运行lobe-chat-plugin-template插件的花,请求不应该会打到这个域名去的,你是不是添加的插件 manifest 不对?本地开发应该 添加 |
@arvinxx |
@arvinxx 现在改成这样了 |
@arvinxx Now it’s changed to this |
@arvinxx 现在都改成localhost了 还是报错 |
@lihui123456 排查下来是我们的模板的问题,抱歉耽搁你时间了🙇♂️ 请把 gateway.ts 的代码替换为 import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';
export const config = {
runtime: 'edge',
};
export default async (req: Request) => {
if (process.env.NODE_ENV === 'development') {
return createGatewayOnEdgeRuntime()(req);
}
return new Response('gateway');
}; 应该是之前更新的时候忘记修改这里的代码了。我去修正一下模板的 |
@arvinxx 我这边可以了,谢谢您 |
@arvinxx I can do it, thank you |
✅ @lihui123456 This issue is closed, If you have any questions, you can comment and reply. |
@lihui123456 更新一下,上述代码在 next build 时会报错。要改成动态导入的方式: export const config = {
runtime: 'edge',
};
export default async (req: Request) => {
if (process.env.NODE_ENV === 'development') {
const { createGatewayOnEdgeRuntime } = await import('@lobehub/chat-plugins-gateway');
return createGatewayOnEdgeRuntime()(req);
}
return new Response('gateway');
}; |
@lihui123456 Update, the above code will report an error during next build. To change to dynamic import: export const config = {
runtime: 'edge',
};
export default async (req: Request) => {
if (process.env.NODE_ENV === 'development') {
const { createGatewayOnEdgeRuntime } = await import('@lobehub/chat-plugins-gateway');
return createGatewayOnEdgeRuntime()(req);
}
return new Response('gateway');
}; |
@arvinxx 好的,非常感谢 |
@arvinxx ok thank you very much |
💻 系统环境
Windows
📦 部署环境
Official Preview
🌐 浏览器
Chrome
🐛 问题描述
请求 URL:
http://xxxxxxx:3400/api/gateway
请求方法:
OPTIONS
状态代码:
500 Internal Server Error
如何解决
🚦 期望结果
docker运行lobe- chat 镜像 本地运行lobe-chat-plugin-template插件,然后lobe-chat 添加插件跨域报错
📷 复现步骤
No response
📝 补充信息
No response
The text was updated successfully, but these errors were encountered: