Back

Function now failing after upgrade to 1.3.4

  • 0
  • Self Hosted
  • Functions
andrewmoore
9 May, 2023, 03:30

I have a function setup to create a new collection, add attributes, create indexes, and then add that new collections info to another table.

This was working perfectly until upgrading to the latest version. Were there specific breaking changes to how function execution was/is happening? Do all the functions need to be rebuilt again?

TL;DR
After upgrading to version 1.3.4, a function that was previously working is now failing. It appears that the Python SDK works differently from other SDKs, as it does not filter out null values from requests. As a result, passing null values to the function causes it to fail. The error message indicates that the argument must be of type bool, but a null value was given. To fix the issue, update the API calls to pass a value for optional parameters instead of null. Additionally, make sure to update the SDK to the latest version.
Drake
9 May, 2023, 03:32

What errors are you seeing?

There weren't any breaking function changes

andrewmoore
9 May, 2023, 03:33

I just get an "Internal Runtime error."

Drake
9 May, 2023, 03:34

Your function is probably throwing an exception

Drake
9 May, 2023, 03:35

Can you manually create a collection and attributes?

andrewmoore
9 May, 2023, 03:35

Where in the docker container logs can I see what exception was thrown?

Drake
9 May, 2023, 03:36

They won't be. It's best to make sure your code doesn't throw any exception

andrewmoore
9 May, 2023, 03:49

So I'm unable to create a collection now, using this command: result = database.create_collection('records', 'unique()', table_name, default_permissions)

And the error I get is: {'message': 'Server Error', 'code': 500, 'type': 'general_unknown', 'version': '1.3.4'}

Not particularly helpful...

Drake
9 May, 2023, 03:50

What do the docker logs for the appwrite container say?

What did you upgrade from?

What did you do exactly to upgrade?

andrewmoore
9 May, 2023, 03:58

Logs: [Error] Timestamp: 2023-05-09T03:47:22+00:00 [Error] Method: POST [Error] URL: /v1/databases/:databaseId/collections [Error] Type: TypeError [Error] Message: {closure}(): Argument #5 ($documentSecurity) must be of type bool, null given, called in /usr/src/code/vendor/utopia-php/framework/src/App.php on line 577 [Error] File: /usr/src/code/app/controllers/api/databases.php [Error] Line: 720

I upgraded from 1.2.0

I followed the upgrade steps provided here: https://appwrite.io/docs/upgrade

Drake
9 May, 2023, 04:05

Hmm....I know there were changes to how we handled input, but, ideally, your old code should still work...let me check with the team.

For now, you may need to update your SDK

andrewmoore
9 May, 2023, 04:10

Okay, thanks. I'll try updating the SDK now and see if that makes a difference.

Drake
9 May, 2023, 04:11

What version of the python SDK did you have?

andrewmoore
9 May, 2023, 04:31

pip list shows the appwrite SDK as being at 1.0.0

andrewmoore
9 May, 2023, 04:37

Updating to 2.0.0 showing the same behaviour there, just FYI.

Drake
9 May, 2023, 04:38

Womp...can you try passing false for document security?

andrewmoore
10 May, 2023, 01:58

If I pass False in to that function call, it does go through as expected. It then fails on the next function call when it goes to create an attribute...

[Error] Timestamp: 2023-05-09T05:04:51+00:00 [Error] Method: POST [Error] URL: /v1/databases/:databaseId/collections/:collectionId/attributes/string [Error] Type: TypeError [Error] Message: {closure}(): Argument #7 ($array) must be of type bool, null given, called in /usr/src/code/vendor/utopia-php/framework/src/App.php on line 577 [Error] File: /usr/src/code/app/controllers/api/databases.php [Error] Line: 1104

Drake
10 May, 2023, 02:00

So it seems like the python SDK works differently than other sdks. The other ones filter out null values from the request but it doesn't look like the python SDK does that.

Drake
10 May, 2023, 02:02

As such, you'd need to update the API calls to pass a value for optional parameters

andrewmoore
10 May, 2023, 02:09

Okay, thanks for looking in to it. So that would be considered a breaking change when upgrading to this new version then?

Drake
10 May, 2023, 02:28

Unfortunately yes...I don't think we realized the python SDK worked differently

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