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?
What errors are you seeing?
There weren't any breaking function changes
I just get an "Internal Runtime error."
Your function is probably throwing an exception
Can you manually create a collection and attributes?
Where in the docker container logs can I see what exception was thrown?
They won't be. It's best to make sure your code doesn't throw any exception
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...
What do the docker logs for the appwrite container say?
What did you upgrade from?
What did you do exactly to upgrade?
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
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
Okay, thanks. I'll try updating the SDK now and see if that makes a difference.
What version of the python SDK did you have?
pip list
shows the appwrite SDK as being at 1.0.0
Updating to 2.0.0
showing the same behaviour there, just FYI.
Womp...can you try passing false for document security?
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
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.
As such, you'd need to update the API calls to pass a value for optional parameters
Okay, thanks for looking in to it. So that would be considered a breaking change when upgrading to this new version then?
Unfortunately yes...I don't think we realized the python SDK worked differently
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...