diff --git a/src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx b/src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx index f364aa2aef0..b9cd7d07acc 100644 --- a/src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx +++ b/src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx @@ -230,6 +230,30 @@ For the **GraphQL API** category, review [Connect to data from Server-side Runti + + +**Note:** If you use the Amplify server-side APIs in a [server action](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations) and encounter the following error running `next build`: + +> ./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/module/index.js + 12 modules + +> Cannot get final name for export 'fromUtf8' of ./node_modules/@smithy/util-utf8/dist-es/index.js + +You can add the following to your `next.config.js`: + +```ts title="next.config.js" +/** @type {import('next').NextConfig} */ +const nextConfig = { + // highlight-start + experimental: { + serverComponentsExternalPackages: ['@aws-crypto'], + }, + // highlight-end +}; +``` + +See Next.js documentation on [`serverComponentsExternalPackages`](https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages) for more details. + + ### With Next.js App Router #### Dynamic rendering in React server component diff --git a/src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx b/src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx index 55b56b3c3f5..7bf1590334a 100644 --- a/src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx +++ b/src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx @@ -232,6 +232,30 @@ For the **GraphQL API** category, review [Connect to GraphQL API from server-sid + + +**Note:** If you use the Amplify server-side APIs in a [server action](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations) and encounter the following error running `next build`: + +> ./node_modules/@aws-amplify/core/node_modules/@aws-crypto/sha256-js/build/module/index.js + 12 modules + +> Cannot get final name for export 'fromUtf8' of ./node_modules/@smithy/util-utf8/dist-es/index.js + +You can add the following to your `next.config.js`: + +```ts title="next.config.js" +/** @type {import('next').NextConfig} */ +const nextConfig = { + // highlight-start + experimental: { + serverComponentsExternalPackages: ['@aws-crypto'], + }, + // highlight-end +}; +``` + +See Next.js documentation on [`serverComponentsExternalPackages`](https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages) for more details. + + ### With Next.js App Router #### In React Server Component