#[SOLVED] Error in inside a function: The document data and permissions are missing

8 messages · Page 1 of 1 (latest)

modest spear
#

I'm trying to update a document in a function with this code:

const document_data = {
  tipo: data.markin.type,
  updated_at: DateTime.now().toISO(),
};

const marking = await databases_user.updateDocument(
  DB_RH,
  C_MARKIN,
  data.marking.$id,
  document_data
);

The functions fails with the error: AppwriteException: The document data and permissions are missing. You must provide either document data or permissions to be updated.

So I logged document_data and I see the data is there before I send it with updateDocument

Then I have replaced the databases.php in the appwrite source code to add some debug logs, I can see the following information when the request is make:

appwrite  | string(2) "db" // $databaseId
appwrite  | string(10) "collection" // $collectionId
appwrite  | string(2) "id" // $documentId
appwrite  | array(0) { // $data
appwrite  | }
appwrite  | NULL // $permissions

So seems like the problem is the SDK not sending the data. But when I try the same function running it with the CLI it works without problem

I'm using:

  • appwrite 1.6.0
  • node-appwrite 14.1.0
  • bun 1.0

What can be happening?

ivory sonnet
#

Heyy 👋
It's this part of the code: https://github.com/appwrite/sdk-for-node/blob/14.1.0/src/services/databases.ts#L1804-L1834

I cant spot a reason why it wouldn't work 🤔
Can you try to switch to node-appwrite verions 15.0.0-rc1 or 14.0.0? See if the problem is persistent across all of them

GitHub

[READ-ONLY] Official Appwrite Node.js SDK 🟢. Contribute to appwrite/sdk-for-node development by creating an account on GitHub.

#

Also, what is type of document_data variabl? Anything out of ordinarry there, like being too large, storing classes, promises, or similar?

modest spear
#

I've tried with
document_data is just this:

const document_data = {
  type: data.marker.type, // IN or OUT
  updated_at: "", // ISO Date
};

SDK 15.0.0-RC1 Same problem
SDK 14.0.0 Same problem
With node it works

The weird thing is, the same function runs locally with the CLI, the only difference is the call method, using local function it's called with postman and with Appwrite I use a button with the node-appwrite SDK

night grove
modest spear
modest spear
#

Ok, after a day of try, I can say it's working without a problem, to sumarize:
I'm working in a local instance of appwrite, I'm using ngrok, but HTTPS wasn't activated so probable because of that all data sent was empty. After forced to HTTPS it worked without a problem

Thank you @night grove @ivory sonnet

#

[SOLVED] Error in inside a function: The document data and permissions are missing