Skip to content

Commit

Permalink
Merge branch 'aws-amplify:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ekjotmultani authored Jan 21, 2025
2 parents dcdfc7f + 19b6501 commit d65004f
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/accessibility_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
jobs:
accessibility:
name: Runs accessibility scan on changed pages
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout branch
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -32,7 +32,7 @@ jobs:
const buildDir = process.env.BUILD_DIR;
return getChangedPages({github, context, buildDir});
- name: Run site
run: |
run: |
python -m http.server 3000 -d ${{ env.BUILD_DIR }} &
sleep 5
- name: Run accessibility tests on changed/new MDX pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_for_console_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: read
jobs:
CheckConsoleErrors:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_pr_for_broken_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
BUILD_DIR: 'client/www/next-build'
jobs:
CheckPRLinks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"amazonaws",
"amazonaws",
"amazoncognito",
"amazonlinux",
"AmazonPersonalizeProvider",
"AmazonS3Client",
"Amplif",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,12 @@ func confirmSignIn() -> AnyCancellable {

To sign in using an external identity provider such as Google, use the `signInWithRedirect` function.

<Callout info>

For guidance on configuring an external Identity Provider with Amplify see [External Identity Providers](/[platform]/build-a-backend/auth/concepts/external-identity-providers/)

</Callout>

```ts
import { signInWithRedirect } from "aws-amplify/auth"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,19 @@ You can alternatively download the introspection schema using the [`fetch-schema
2. On the left side, select Schema
3. When viewing your schema, there should a “Export schema” drop down. Select this and download the `schema.json` file.
4. Add this file to your project as directed by [Apollo documentation](https://www.apollographql.com/docs/kotlin/advanced/plugin-recipes#specifying-the-schema-location)

### Type Mapping AppSync Scalars
By default, [AWS AppSync Scalars](https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html#graph-ql-aws-appsync-scalars) will default to the `Any` type. You can map these scalars to more explicit types by editing the `apollo` block in your `app/build.gradle[.kts]` file. In the example below, we are now mapping a few of our AppSync scalar types to `String` instead of `Any`. Additional improvements could be made by writing [custom class adapters](https://www.apollographql.com/docs/kotlin/essentials/custom-scalars#define-class-mapping) to convert date/time scalars into Kotlin date/time class types.

```kotlin
apollo {
service("{serviceName}") {
packageName.set("{packageName}")
mapScalarToKotlinString("AWSDateTime")
mapScalarToKotlinString("AWSEmail")
}
}
```
</InlineFilter>

### Performing Queries, Mutations, and Subscriptions with Apollo client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ AWS Amplify Gen 2 functions are AWS Lambda functions that can be used to perform

<Callout warning>

**Note:** [Fullstack Git-based environments](https://docs.amplify.aws/react/how-amplify-works/concepts/#fullstack-git-based-environments) do not support Docker for functions bundling out of the box.
**Note:** [Fullstack Git-based environments](https://docs.amplify.aws/react/how-amplify-works/concepts/#fullstack-git-based-environments) do not support Docker for functions bundling out of the box. To learn more [skip to the Docker section](#docker).

</Callout>

Expand Down Expand Up @@ -81,7 +81,7 @@ Next, create the corresponding handler file at `amplify/functions/say-hello/inde

```ts title="amplify/functions/say-hello/index.py"
import json

def handler(event, context):
return {
"statusCode": 200,
Expand All @@ -104,7 +104,7 @@ some-other-package>=1.0.0
You're now ready to deploy your python function. Next is the same process as the Node.js/TypeScript function. Go to [Common steps for all languages](#common-steps-for-all-languages) to continue.
## Go
To get started, Create a new directory and a resource file, `amplify/functions/say-hello/resource.ts`. Then, define the function with `defineFunction`:
To get started, Create a new directory and a resource file, `amplify/functions/say-hello/resource.ts`. Then, define the function with `defineFunction`:
```ts title="amplify/functions/say-hello/resource.ts"
import { execSync } from "node:child_process";
Expand Down Expand Up @@ -187,7 +187,7 @@ go mod tidy

You're now ready to deploy your golang function. Next is the same process as the Node.js/TypeScript function.

## Common steps for all languages
## Common steps for all languages

Regardless of the language used, your function needs to be added to your backend.
```ts title="amplify/backend.ts"
Expand Down Expand Up @@ -228,3 +228,20 @@ export const data = defineData({
},
})
```

## Docker

Custom function may require [Docker](https://www.docker.com/) in order to build and bundle function's code. A deployment failing with `CustomFunctionProviderDockerError` error indicates that a custom function requires Docker but the Docker daemon was not found. In that case you need to provide a working Docker installation at runtime.

### Personal sandboxes

Ensure that Docker is installed on your computer and that Docker daemon is running. You can check if Docker daemon is running using the following command:
```bash title="terminal" showLineNumbers={false}
docker info
```

### Fullstack Git-based environments

Amplify does not provide Docker daemon out of the box in branch deployments. However, you have an option to provide [your own image that meets Amplify requirements](https://docs.aws.amazon.com/amplify/latest/userguide/custom-build-image.html) and includes a Docker installation.

For example, the `aws/codebuild/amazonlinux-x86_64-standard:5.0` image ([see definition](https://github.com/aws/aws-codebuild-docker-images)) meets Amplify requirements and includes Docker installation.

0 comments on commit d65004f

Please sign in to comment.