Skip to content

Commit 613542c

Browse files
authored
Resolve Typescript validation check failed (#7639)
The hander definition previously didn't include a type so the "npx ampx sandbox" compilation would fail and say: amplify/functions/say-hello/handler.ts(1,31): error TS7006: Parameter 'event' implicitly has an 'any' type. TypeScript validation check failed. Resolution: Fix the syntax and type errors in your backend definition.
1 parent 659e807 commit 613542c

File tree

1 file changed

+3
-1
lines changed
  • src/pages/[platform]/build-a-backend/functions/set-up-function

1 file changed

+3
-1
lines changed

src/pages/[platform]/build-a-backend/functions/set-up-function/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export const sayHello = defineFunction({
5353
Next, create the corresponding handler file at `amplify/functions/say-hello/handler.ts`. This is where your function code will go.
5454

5555
```ts title="amplify/functions/say-hello/handler.ts"
56-
export const handler = async (event) => {
56+
import { Handler } from 'aws-lambda';
57+
58+
export const handler: Handler = async (event, context) => {
5759
// your function code goes here
5860
return 'Hello, World!';
5961
};

0 commit comments

Comments
 (0)