Back

createExecutation

  • 0
  • Web
L
12 Dec, 2023, 19:45

Good afternoon, I'm experiencing some problems after updating my appwrite and I don't know what's happening.

TypeScript
 const user_example = await functions.createExecution(
          'example',
          JSON.stringify({
            username: user.username,
            password: user.password,
          }),
          false
        )
      
        response = JSON.parse(user_example.response)

        await databases.updateDocument(
          'lumes_dev',
          'users',
          users.documents[0].$id,
          {
            password: null,
            id_matrix: response.user_id,
            clients_brokerage: [client_brokerage.$id],
          }
        )

this is my function before updating to version 1.3.7, I execute a function outside and wait for its response, after that I do a jsonparse on the response and save it in the table, the problem is that in version 1.3.7 it works and in 1.4.13 it gives this error Return statement missing. return context.res.empty() if no response is expected.

TL;DR
The user is experiencing issues after updating their appwrite version. They have a function that uses createExecution to call another function and parse the response using JSON.parse. However, after upgrading to a newer version, JSON.parse returns context.res.empty() even when the response has valid data. The user is unsure why this is happening. Solution: The user should check if they have created a new function after upgrading to version 1.4. It is also recommended to wrap code in backticks for better formatting.
Drake
12 Dec, 2023, 23:43

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

Drake
12 Dec, 2023, 23:45

what's your function code? did you create a new function after upgrading to 1.4?

L
13 Dec, 2023, 11:25

I created a new function with the defaults of the new version

L
13 Dec, 2023, 11:32

What's happening is the following: in version 1.3.7, I had a function in which it used createExecution to call another function. I waited for the response from this method, performed a JSON.parse() on that response and used the resulting data to save it in a collection. The problem is that, after upgrading to a more recent version, whenever I try to use JSON.parse in the function, it returns context.res.empty(), even when the response from the called function contains valid data in the response. Please correct and improve the text if necessary. and I can't identify why

Drake
13 Dec, 2023, 20:08

Oye function calling function is not a good idea 👀

Drake
13 Dec, 2023, 20:09

Sorry, I'm unclear on what exactly is going on. Would you be able to share the code for the 2 functions and the response from both?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more