[SOLVED] Troubleshooting Appwrite PHP Function: Document Deletion Issue
- 0
- Databases
- Functions
- Self Hosted
- Cloud

But, when it fails, what error do you see?

it says no errors recorded

And no response?

Yes there is no response if i send the payload with the correct request.

It means it crashes before Can you share the payload and the response in the network tab? Like so:

the payload: {
"documentId": "64abc0eee265357c5f51" }

Can you share screenshot like this

ok


Why is your data
includes the text the payload:

Can you share this screen giht before you're clicking the Execute now
button


I updated the code and after i send the payload the response is: {"success":false,"message":"Missing required data: collectionId or documentId"}

Try to put all the custome data in one line, like such:

{"documentId":"64abc0eee265357c5f51"}

Ohh
And also you haven't send the collectionId
in the JSON

I also sent the collection id but i get the same error

In this if
add the payload
and share it, so we can spot the issue
if (empty($collectionId) || empty($documentId)) {
return $res->json([
'success' => false,
'message' => 'Missing required data: collectionId or documentId',
'payload' => $req['payload']
], 400);
}
Also, in this line you'll need to parse the payload
not data
$requestData = json_decode($req['payload'], true);

Yes, I have realised the problem. The problem was this line: $database->deleteDocument($collectionId, [$documentId]); The document Id was an array instead of string. So I changed this line into this: $response = $database->deleteDocument($databaseId, $collectionId, $documentId);. Now it works

Great !

[SOLVED] Troubleshooting Appwrite PHP Function: Document Deletion Issue

The logs: Warning: Trying to access array offset on value of type null in /usr/code-start/src/index.php on line 39

response: title is required

Response: {"success":false,"message":"Invalid payload. eventData is missing."}

I think you ahve the wrong thread
Recommended threads
- Appwrite Cloud + Firebase hosting login ...
Hey team, can you please add the following to the CORS allowlist for my cloud project? Project ID: 68633b67002faf66fbcf Domains to allow: - https://taggit-...
- Realtime Disconnects and Error: INVALID_...
Hi Support, we are still experiencing the issue and we are a subscriber on your platform under the account of charlesbcalague@gmail.com I just want to ask here...
- Collection Permission issue
I am facing issue in my Pro account. "Add" button is disabled while adding permission in DB collection settings.
