yixiaojiu / bilibili-bangumi-component

展示 bilibili 与 Bangumi 追番列表的 WebComponent 组件
https://note.yixiaojiu.top/docs/record/bangumi
MIT License
9 stars 8 forks source link

【Bug】vercel部署后访问失败 #2

Closed MengNianxiaoyao closed 9 months ago

MengNianxiaoyao commented 9 months ago

Clip_2024-02-19_11-39-11 Clip_2024-02-19_11-40-05

yixiaojiu commented 9 months ago

请求地址为什么是 http://localhost:3000/api

yixiaojiu commented 9 months ago
image image

你可以查一下 vercel 的构建记录,看看是否有 functions

yixiaojiu commented 9 months ago

如果你是本地调试的话,可以运行 vercel dev,然后就可以通过 http://localhost:3000/api 调用接口了

MengNianxiaoyao commented 9 months ago

image image 你可以查一下 vercel 的构建记录,看看是否有 functions

没有

MengNianxiaoyao commented 9 months ago

搞定了,真是难蚌。 根目录得root,framework要other,vercel默认的直接不行

yixiaojiu commented 9 months ago

我看看能不能在vercel.json里默认配置好

MengNianxiaoyao commented 9 months ago

文档里得给个vercel的部署步骤和部署成功的例图,部署成功我记得是打印出了hhh cf的worker也可以写一个,我测试就是没有Access-Control-Allow-Origin这个响应标头的报错

yixiaojiu commented 9 months ago

等会完善一下。没用过cf,对cf不熟😭

MengNianxiaoyao commented 9 months ago

等会完善一下。没用过cf,对cf不熟😭

cf的worker就是serverless function,和val towm差不多

yixiaojiu commented 9 months ago

文档里得给个vercel的部署步骤和部署成功的例图,部署成功我记得是打印出了hhh cf的worker也可以写一个,我测试就是没有Access-Control-Allow-Origin这个响应标头的报错

增加了对 cloudflare worker 的支持 https://github.com/yixiaojiu/bilibili-bangumi-component/blob/main/api/cloudflare.js

image 环境变量在这添加