nicoalbanese / kirimase

Build full-stack Next.js apps, incredibly fast
https://kirimase.dev
MIT License
2.64k stars 122 forks source link

Dev build errors on local & vercel, on a fresh 'kirimase init' #48

Closed embersee closed 1 year ago

embersee commented 1 year ago

Hello, so I've been trying to get this to run for the past week, heres the error:

It occurs whenever i call const data = api.computers.getComputers.query(); from the index page.tsx server-side. This does not occur if i callconst data = trpc.computers.getComputers.useQuery(); from client-side. It does not crash the dev environment (won't build), but error still shows in terminal. Anybody else encounter this?

revalidating cache with key: async (_cachebuster)=>{
                        //   // _cachebuster is not used by us but to make sure
                        //   // that calls with different tags are properly separated
                        //   // @link https://github.com/trpc/trpc/issues/4622
                        const procedureResult = await (0,_trpc_server__WEBPACK_IMPORTED_MODULE_1__.callProcedure)({
                            procedures: opts.router._def.procedures,
                            path,
                            rawInput: input,
                            ctx: ctx,
                            type
                        });
                        // We need to serialize cause the cache only accepts JSON
                        return runtime.transformer.serialize(procedureResult);
                    }-computers,getComputers-["computers.getComputers"] Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store'
    at /Users/philipp/Code/delphox/node_modules/next/dist/server/lib/patch-fetch.js:187:27
    ... 14 lines matching cause stack trace ...
    at QueryPromise.then (webpack-internal:///(rsc)/./node_modules/drizzle-orm/alias-cf8e03cd.mjs:504:21) {
  code: 'INTERNAL_SERVER_ERROR',
  name: 'TRPCError',
  [cause]: Error: cache: 'force-cache' used on fetch for https://aws.connect.psdb.cloud/psdb.v1alpha1.Database/Execute with 'export const fetchCache = 'only-no-store'
      at /Users/philipp/Code/delphox/node_modules/next/dist/server/lib/patch-fetch.js:187:27
      at /Users/philipp/Code/delphox/node_modules/next/dist/server/lib/trace/tracer.js:117:36
      at NoopContextManager.with (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
      at ContextAPI.with (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
      at NoopTracer.startActiveSpan (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)
      at ProxyTracer.startActiveSpan (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)
      at /Users/philipp/Code/delphox/node_modules/next/dist/server/lib/trace/tracer.js:106:107
      at NoopContextManager.with (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)
      at ContextAPI.with (/Users/philipp/Code/delphox/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)
      at NextTracerImpl.trace (/Users/philipp/Code/delphox/node_modules/next/dist/server/lib/trace/tracer.js:106:32)
      at globalThis.fetch (/Users/philipp/Code/delphox/node_modules/next/dist/server/lib/patch-fetch.js:93:47)
      at postJSON (webpack-internal:///(rsc)/./node_modules/@planetscale/database/dist/index.js:147:28)
      at Connection.execute (webpack-internal:///(rsc)/./node_modules/@planetscale/database/dist/index.js:99:29)
      at PlanetScalePreparedQuery.execute (webpack-internal:///(rsc)/./node_modules/drizzle-orm/planetscale-serverless/index.mjs:40:39)
      at MySqlSelect.execute (webpack-internal:///(rsc)/./node_modules/drizzle-orm/view-23898f21.mjs:1314:35)
      at QueryPromise.then (webpack-internal:///(rsc)/./node_modules/drizzle-orm/alias-cf8e03cd.mjs:504:21)
}
vzkharov commented 12 months ago

Faced the same issue here, whenever I use trpc experimental_nextCacheLink in rsc


Addition


Any updates?

embersee commented 12 months ago

Faced the same issue here, whenever I use trpc experimental_nextCacheLink in rsc

Addition

* In `trpc` procedure data fetched from `upstash`

Any updates?

Heya, so sorry in advance for the messy issue, I hadn't stated the kirimase version at the time, but it was a commit with errors in the code generation, I believe it was kirimase v0.0.15 release.

I decided to not use next experimental features, so I'm not sure if this is of much relevance but I managed to fix the client / server relation errors after I restructured the /trpc directory like so. Also meaning I decided to undo most of the code generated by kirimase, and just did my own implementation after fixing other stuff related to it, such as prisma type generation etc.

If you still face issues, probably best if you open a new issue, as this one was closed with no clear fix, other than to not use this projects code generation.

nicoalbanese commented 12 months ago

Hey guys - Kirimase updated its tRPC implementation to mimic that of t3 a few versions back (similar to what @embersee has included in his repo). The folder structure is slightly different to separate the context into it's own file but is otherwise almost identical. This issue is unfortunately something that is to do with next's implementation of server components and the service being used (we had seen this error arising with planetscale most frequently).