Skip to content

AppSyncFunction

Reference doc for the `sst.aws.AppSyncFunction` component.

The AppSyncFunction component is internally used by the AppSync component to add functions to AWS AppSync.

You’ll find this component returned by the addFunction method of the AppSync component.


Constructor

new AppSyncFunction(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.function

Type Function

The Amazon AppSync Function.

FunctionArgs

apiId

Type Input<string>

The AppSync GraphQL API ID.

code?

Type Input<string>

The function code that contains the request and response functions.

{
code: fs.readFileSync("functions.js")
}

dataSource

Type Input<string>

The data source this resolver is using. This only applies for “unit” resolvers.

{
dataSource: "lambdaDS"
}

name

Type string

The name of the AppSync function.

{
name: "myFunction",
}

requestMappingTemplate?

Type Input<string>

The function request mapping template.

{
dataSource: "dynamoDS",
requestTemplate: `{
"version": "2018-05-29",
"operation": "Scan",
}`,
}

responseMappingTemplate?

Type Input<string>

The function response mapping template.

{
dataSource: "dynamoDS",
responseTemplate: `{
"users": $utils.toJson($context.result.items)
}`,
}

transform?

Type Object

Transform how this component creates its underlying resources.

transform.function?

Type FunctionArgs | (args: FunctionArgs => void)

Transform the AppSync Function resource.