一键部署失败以及部署成功后gemini不回复的修复 #8
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题1:一键部署时失败,提示:"Deploy did not succeed: Build cancelled, found file owned by root"
原因:Netlify 会自动运行 npm install 或 yarn install,所以 node_modules 不应提交到 GitHub
解决:删除.gitignore内的node_modules后部署成功。
问题2:部署成功后,gemini不回复,netlify报错:"TypeError: RequestInit: duplex option is required when sending a body."
原因:当Netlify Function 使用 fetch() 发送带有请求体(如 POST、PUT)的请求时,必须显式设置 duplex: "half"
解决:在proxy.ts文件做以下修改,
const response = await fetch(url, { body: request.body, method: request.method, headers, duplex: "half" // 必须添加此行 });