Skip to content

Commit

Permalink
add details on values in context stash
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Dec 3, 2024
1 parent 36d034a commit 03dd5ca
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ export const data = defineData({
});
```

Amplify will store some values in the resolver context stash that can be accessed in the custom resolver.

| Name | Description |
| ----------------- | ------------------------------------------- |
| awsAppsyncApiId | The ID of the AppSync API. |
| amplifyBranchName | The Amplify branch name. (`NONE` in sandbox) |

The Amplify generated DynamoDB table names can be constructed from the variables in the context stash. The table name is in the format `<model-name>-<aws-appsync-api-id>-<amplify-branch-name>`. For example, the table name for the `Post` model would be `Post-123456-dev` where `123456` is the AppSync API ID and `dev` is the Amplify branch name.

```ts title="amplify/data/BatchCreatePostHandler.js"
import { util } from '@aws-appsync/utils';
export function request(ctx) {
Expand Down

0 comments on commit 03dd5ca

Please sign in to comment.