payloadcms / custom-website-series Goto Github PK
View Code? Open in Web Editor NEWA fully custom website built with Payload and Next.js
A fully custom website built with Payload and Next.js
I took this project last year and modified it for my specific use, now i wanted to upgrade it to nextjs 13 and latest payload but am getting errors, was wondering if the repo can be updated. its a nightmare for me.
Everything works great on local. But, deployment doesn't seem to work. First time I deployed the error was the following
node:internal/process/promises:279
6:27:50 PM: triggerUncaughtException(err, true /* fromPromise */);
6:27:50 PM: ^
6:27:50 PM: FetchError: invalid json response body at https://server/api/studies reason: Unexpected token < in JSON at position 0
6:27:50 PM: at /opt/build/repo/node_modules/node-fetch/lib/index.js:272:32
6:27:50 PM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
6:27:50 PM: at async getStaticPaths (/opt/build/repo/.next/server/pages/studies/[page].js:25:23)
6:27:50 PM: at async buildStaticPaths (/opt/build/repo/node_modules/next/dist/build/utils.js:16:80)
6:27:50 PM: at async /opt/build/repo/node_modules/next/dist/build/utils.js:26:622
6:27:50 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:6:584) {
6:27:50 PM: type: 'invalid-json'
6:27:50 PM: }
Second time, it was the following
7:26:09 PM: node:internal/process/promises:279
7:26:09 PM: triggerUncaughtException(err, true /* fromPromise */);
7:26:09 PM: ^
7:26:09 PM: FetchError: invalid json response body at https://server/api/studies?limit=100 reason: Unexpected token < in JSON at position 0
7:26:09 PM: at /opt/build/repo/node_modules/node-fetch/lib/index.js:272:32
7:26:09 PM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
7:26:09 PM: at async getStaticPaths (/opt/build/repo/.next/server/pages/study/[study].js:271:21)
7:26:09 PM: at async buildStaticPaths (/opt/build/repo/node_modules/next/dist/build/utils.js:16:80)
7:26:09 PM: at async /opt/build/repo/node_modules/next/dist/build/utils.js:26:622
7:26:09 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:6:584) {
7:26:09 PM: type: 'invalid-json'
7:26:09 PM: }
Third time,
7:31:54 PM: node:internal/process/promises:279
7:31:54 PM: triggerUncaughtException(err, true /* fromPromise */);
7:31:54 PM: ^
7:31:54 PM: FetchError: invalid json response body at https://server/api/pages?limit=100 reason: Unexpected token < in JSON at position 0
7:31:54 PM: at /opt/build/repo/node_modules/node-fetch/lib/index.js:272:32
7:31:54 PM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
7:31:54 PM: at async getStaticPaths (/opt/build/repo/.next/server/chunks/488.js:484:20)
7:31:54 PM: at async buildStaticPaths (/opt/build/repo/node_modules/next/dist/build/utils.js:16:80)
7:31:54 PM: at async /opt/build/repo/node_modules/next/dist/build/utils.js:26:622
7:31:54 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/telemetry/trace/trace.js:6:584) {
7:31:54 PM: type: 'invalid-json'
7:31:54 PM: }
I tried converting studiesReq to text instead and logging it to the console. Here's what I found
6:56:24 PM: info - Checking validity of types...
6:56:32 PM: Failed to compile.
6:56:32 PM:
6:56:32 PM: ./pages/studies/[page].tsx:11:14
6:56:32 PM: Type error: Type '() => Promise' is not assignable to type 'GetStaticPaths'.
6:56:32 PM: Type 'Promise' is not assignable to type 'Promise<GetStaticPathsResult>'.
6:56:32 PM: Type 'void' is not assignable to type 'GetStaticPathsResult'.
6:56:32 PM: 9 | };
6:56:32 PM: 10 |
6:56:32 PM: > 11 | export const getStaticPaths: GetStaticPaths = async () => {
6:56:32 PM: | ^
6:56:32 PM: 12 | const studiesReq = await fetch(${process.env.NEXT_PUBLIC_SERVER_URL}/api/studies
);
6:56:32 PM: 13 | // const studiesData = await studiesReq.json();
6:56:32 PM: 14 | const studiesData = await studiesReq.text();
I tried looking up some solutions and it's recommended that await be used to resolve the promise before the assignment. But, it's already what's being done. I hit a dead end. Could you please help?
I really think that this site would give so much opportunity to learn from, and so much more so if it came with its seed content. Would it be possible to put that back in?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.