aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 77 forks source link

Per model configuration not being honoured #1192

Open vishal-dms opened 1 year ago

vishal-dms commented 1 year ago

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

10.5.1 or latest as well

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

Per model configuration, updated through Amplify CLI is not being applied to the respective models (which still continue to use default configuration)

Expected behavior

Amplify CLI should be able to deploy Per model configuration as documented

Reproduction steps

  1. amplify add api - Push any two models
  2. amplify update api - For the second model override the conflict strategy to Optimistic Concurrency
    Do you want to override default per model settings? Yes
    ? Select the models from below: Note
    ? Select the resolution strategy for Note model Optimistic Concurrency
  3. Verify from AppSync console as well the model.json files from within _api/api_name/build/stacks/modelname.json to verify that this model's resolvers still have default conflict resolution strategy instead of overridden one

Project Identifier

033d150b45772ea4e67cf4ee6650fc8c

Log output

``` # Put your logs below this line ```

Additional information

We currently have to look into overriding the sync config for such models using amplify override api and then manually update the syncConfig for the desired model's resolvers

Before submitting, please confirm:

Dennis-Dekker commented 1 year ago

Can this issue be reopened? I still have a problem with the per model configuration. I'm not using the Optimistic Concurrency, but the custom lambda. First of all, the functions of the changed model(s) in the Appsync console are not changed to the custom lambda. Next to this, if I manually set the custom lambda in the model I get an error in Datastore (clientside) stating that the APPSYNC_ASSUME_ROLE is not authorized to perform the lambda:InvokeFunction action.

chrisbonifacio commented 1 year ago

Hi @Dennis-Dekker :wave:

I will re-open this issue and reach out to the team to see what we might've missed in the previous fix.

Can you also please run amplify diagnose --send-report and share the project identifier from the output? This will help us gain some insight into your amplify app and configuration.

Dennis-Dekker commented 1 year ago

Hi @chrisbonifacio,

Thank you for helping out! I have run some different configurations with the conflict resolution strategy. Here is a list of configurations I tried (below, in run order), they are all under project Id 6db571214cc1ed81638fa003a307b328. I don't know if you can access all of them as I ran the amplify diagnose --send-report 4 times, if not I can provide you with the .zip files for each run.

On Discord, we also have a thread open for this issue (https://discordapp.com/channels/705853757799399426/1076342999421816892). I you need more info to investigate this I'm happy to help.

Dennis-Dekker commented 1 year ago

@chrisbonifacio snklip (fellow discord user) and I have been trying out some more different configurations and found some insights that may help you fix this problem, you can find this on this AWS Amplify discord thread: https://discord.com/channels/705853757799399426/1076342999421816892 Feel free to reach out to us here or on Discord if you need more info!

Dennis-Dekker commented 1 year ago

@chrisbonifacio Any updates on this issue?

adeldueast commented 5 months ago

@chrisbonifacio snklip (fellow discord user) and I have been trying out some more different configurations and found some insights that may help you fix this problem, you can find this on this AWS Amplify discord thread: https://discord.com/channels/705853757799399426/1076342999421816892 Feel free to reach out to us here or on Discord if you need more info!

works but now when i update my model the function in appsync gets detach and i have to manually add it again.. lol