I implemented the Huawei's Cloud DB and Auth Service into my project. After i create my Cloud DB Zone and Object Types i tried to use the executeUpsert() function of Cloud DB. But i got an error message that says "Permission Denied". Program executes all database operations after user authenticated. And authenticated users has permission to update the table. I don't know how to solve this permission problem. Does anyone have opinion?
-
hi@Tolgahan Tutar, Can you check whether the Auth Service is successfully logged in? – zhangxaochen Feb 14 '22 at 01:40
-
I checked it, i can get the logged user information. – Tolgahan Tutar Feb 15 '22 at 13:39
2 Answers
I talked to some employees who are authorized in Huawei's Cloud DB and they helped me to find the cause of the problem. When i was getting the error, as you see in the screenshot below, the instance when user gets authentication and the instance when i initialize the AGConnectCloudDB were different.
after i defined the instance object globally and use the same instance when i am getting the auth and also initializing the AGConnectCloudDB object as you see in the below picture, the problem is solved!

- 53
- 10
Even though you implemented Huawei's Cloud DB and Auth Service into your project, there are still cases that can cause the “permission denied” error. https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-clouddb-error-code-0000001117436042
Please check the following areas in your project to rule out the causes.
If in the log, you see auth error as well, please check:
If the above are all cleared out and the issue is still there, please provide more details for further troubleshooting.

- 1,947
- 2
- 5
- 20
-
I changed the initialization of the AGConnectCloudDB object from `val instance = AGConnectInstance.buildInstance(AGConnectOptionsBuilder().setRoutePolicy( AGCRoutePolicy.CHINA).build(this)); mCloudDB = AGConnectCloudDB.getInstance(instance, AGConnectAuth.getInstance(instance))` to `mCloudDB = AGConnectCloudDB.getInstance()` and problem solved. I know the new method is deprecated but i couldn't find any other way and i don't get why it is solved the problem. – Tolgahan Tutar Feb 15 '22 at 13:55