adrianhajdin / healthcare

Build a healthcare platform that streamlines patient registration, appointment scheduling, and medical records, and learn to implement complex forms and SMS notifications.
https://jsmastery.pro
1.86k stars 443 forks source link

An error occurred while scheduling an appointment: AppwriteException: Missing required parameter: "documentId" #47

Open CJBLACK24 opened 2 weeks ago

CJBLACK24 commented 2 weeks ago

I am stuck in the New Appointment Form Page. When I was about to click Create New Appointment, I encountered this error: Missing required parameter: "documentId." pls thanks

CJBLACK24 commented 2 weeks ago

POST /patients/669ce994002f41c19d96/register 200 in 5269ms ○ Compiling /patients/[userId]/new-appointment ... ✓ Compiled /patients/[userId]/new-appointment in 6.1s (3671 modules) An error occurred while retrieving the patient details: SyntaxError: "undefined" is not valid JSON at JSON.parse () at parseStringify (webpack-internal:///(rsc)/./lib/utils.ts:17:38) at $$ACTION_2 (webpack-internal:///(rsc)/./lib/actions/patient.actions.ts:65:70) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async NewAppointment (webpack-internal:///(rsc)/./app/patients/[userId]/new-appointment/page.tsx:28:21) GET /patients/669ce994002f41c19d96/new-appointment?_rsc=7azd2 200 in 880ms An error occurred while scheduling an appointment: AppwriteException: Missing required parameter: "documentId" at Databases.updateDocument (webpack-internal:///(action-browser)/./node_modules/node-appwrite/dist/services/databases.mjs:1695:13) at $$ACTION_3 (webpack-internal:///(action-browser)/./lib/actions/appointment.actions.ts:110:98) at endpoint (webpack-internal:///(action-browser)/./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CUsers%5C%5Crestr%5C%5COneDrive%5C%5CDesktop%5C%5Ccarepulse%5C%5Clib%5C%5Cactions%5C%5Cappointment.actions.ts%22%2C%5B%22updateAppointment%22%2C%22sendSMSNotification%22%2C%22getRecentAppointmentList%22%2C%22%24%24ACTION_1%22%2C%22%24%24ACTION_2%22%2C%22getAppointment%22%2C%22createAppointment%22%2C%22%24%24ACTION_0%22%2C%22%24%24ACTION_4%22%2C%22%24%24ACTION_3%22%5D%5D%5D&__client_imported__=true!:17:17) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:39:418 at async rw (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:38:7978) at async r6 (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:41:1256) at async doRender (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:1438:30) at async cacheEntry.responseCache.get.routeKind (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:1587:40) at async DevServer.renderToResponseWithComponentsImpl (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:1507:28) at async DevServer.renderPageComponent (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:1931:24) at async DevServer.renderToResponseImpl (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:1969:32) at async DevServer.pipeImpl (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:920:25) at async NextNodeServer.handleCatchallRenderRequest (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\next-server.js:272:17) at async DevServer.handleRequestImpl (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\base-server.js:816:17) at async C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\dev\next-dev-server.js:339:20 at async Span.traceAsyncFn (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\trace\trace.js:154:20) at async DevServer.handleRequest (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\dev\next-dev-server.js:336:24) at async invokeRender (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\lib\router-server.js:174:21) at async handleRequest (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\lib\router-server.js:353:24) at async requestHandlerImpl (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\lib\router-server.js:377:13) at async Server.requestListener (C:\Users\restr\OneDrive\Desktop\carepulse\node_modules\next\dist\server\lib\start-server.js:141:13) { code: 0, type: '', response: '' }

CHIRAG-DAMANI-08 commented 1 week ago

anything ?

aln1234 commented 6 days ago

hi, I was getting the same issue. The error is in the patient get server action. If you console log the patient data it is not fetching anything from the backend so instead of creating the appointment it is running the update appointment code for which it is asking for document Id. To resolve this you need to get the patient detail first. For this you need to update the node appwrite dependency to the latest version, it will solve the issue.