blog-project was forked from Fork of blog-project
Continue chatting to ask questions about or make changes to it.
my backend url is in .env
const API_URL = process.env.NEXT_PUBLIC_API_URL
[{ "resource": "/e:/Projects/Thay Tech Website (Nextjs, Java)/Thay_Tech-Website-2/lib/posts.ts", "owner": "typescript", "code": "2769", "severity": 8, "message": "No overload matches this call.\n Overload 1 of 2, '(input: string | URL | Request, init?: RequestInit | undefined): Promise<Response>', gave the following error.\n Argument of type 'string | undefined' is not assignable to parameter of type 'string | URL | Request'.\n Type 'undefined' is not assignable to type 'string | URL | Request'.\n Overload 2 of 2, '(input: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>', gave the following error.\n Argument of type 'string | undefined' is not assignable to parameter of type 'URL | RequestInfo'.\n Type 'undefined' is not assignable to type 'URL | RequestInfo'.", "source": "ts", "startLineNumber": 15, "startColumn": 34, "endLineNumber": 15, "endColumn": 41 },{ "resource": "/e:/Projects/Thay Tech Website (Nextjs, Java)/Thay_Tech-Website-2/lib/posts.ts", "owner": "typescript", "code": "2769", "severity": 8, "message": "No overload matches this call.\n Overload 1 of 2, '(input: string | URL | Request, init?: RequestInit | undefined): Promise<Response>', gave the following error.\n Argument of type 'string | undefined' is not assignable to parameter of type 'string | URL | Request'.\n Type 'undefined' is not assignable to type 'string | URL | Request'.\n Overload 2 of 2, '(input: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>', gave the following error.\n Argument of type 'string | undefined' is not assignable to parameter of type 'URL | RequestInfo'.\n Type 'undefined' is not assignable to type 'URL | RequestInfo'.", "source": "ts", "startLineNumber": 34, "startColumn": 34, "endLineNumber": 34, "endColumn": 41 }]
corretly first upload the image to vercel blob storage , next the image url should be save in the java backend , u can see my backend code for reference
update my code
dont create new files
To address the issues described in the error logs, we'll need to make several changes to the existing code. Let's use the React Project component to update the relevant files.
These updates should resolve the API connectivity issues, CORS problems, and image upload errors. The SSR warning for Tiptap should also be addressed. Remember to restart your development server after making these changes and updating your environment variables.
Please make sure to add the following environment variable to your project:
requests.js:1
POST https://backend-hr-portal.onrender.com/api/blogs 403 (Forbidden)
s.fetch @ requests.js:1 createPost @ posts.ts:49 handleSave @ PostEditor.tsx:88 onClick @ PostEditor.tsx:211 callCallback @ react-dom.development.js:20565 invokeGuardedCallbackImpl @ react-dom.development.js:20614 invokeGuardedCallback @ react-dom.development.js:20689 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:20703 executeDispatch @ react-dom.development.js:32128 processDispatchQueueItemsInOrder @ react-dom.development.js:32160 processDispatchQueue @ react-dom.development.js:32173 dispatchEventsForPlugins @ react-dom.development.js:32184 eval @ react-dom.development.js:32374 batchedUpdates$1 @ react-dom.development.js:24953 batchedUpdates @ react-dom.development.js:28844 dispatchEventForPluginEventSystem @ react-dom.development.js:32373 dispatchEvent @ react-dom.development.js:30141 dispatchDiscreteEvent @ react-dom.development.js:30112 app-index.tsx:25 Failed to create post: Error: HTTP error! status: 403 at createPost (posts.ts:57:13) at async handleSave (PostEditor.tsx:88:11) window.console.error @ app-index.tsx:25 console.error @ hydration-error-info.ts:72 createPost @ posts.ts:61 await in createPost handleSave @ PostEditor.tsx:88 onClick @ PostEditor.tsx:211 callCallback @ react-dom.development.js:20565 invokeGuardedCallbackImpl @ react-dom.development.js:20614 invokeGuardedCallback @ react-dom.development.js:20689 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:20703 executeDispatch @ react-dom.development.js:32128 processDispatchQueueItemsInOrder @ react-dom.development.js:32160 processDispatchQueue @ react-dom.development.js:32173 dispatchEventsForPlugins @ react-dom.development.js:32184 eval @ react-dom.development.js:32374 batchedUpdates$1 @ react-dom.development.js:24953 batchedUpdates @ react-dom.development.js:28844 dispatchEventForPluginEventSystem @ react-dom.development.js:32373 dispatchEvent @ react-dom.development.js:30141 dispatchDiscreteEvent @ react-dom.development.js:30112 app-index.tsx:25 Error saving post: Error: Failed to create post at createPost (posts.ts:62:11) at async handleSave (PostEditor.tsx:88:11)
i cant post the blogs
fix it
check my backend code also fix everything