问题
Unexpected end of JSON input
或 Unterminated string in JSON at position
错误Stack(Turborepo)
代码
// apps/api/pages/api/trpc/[trpc].ts
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
});
// apps/client/next.config.ts
async rewrites() {
return [
{
source: "/api/trpc/:path*",
destination: `${process.env.NEXT_PUBLIC_API}/api/trpc/:path*`,
},
];
},
回复样本
// status: 200 GET
[
{
"result": {
"data": {
"json": [
{
"items": [
{
"id": "uuid",
"label": "label",
"status": "statusA",
"history": [
{
"creatorA // => creatorAccount
// status: 200 POST
[
{
"result": {
"data": {
"json": {
"ok": true
},
"meta": {
"v
我尝试过的事情
确保所有查询/突变都像以前一样工作
未设置CORS设置,我添加了,问题已解决。