1

I have a Next.js 15 project that uses AWS Amplify (Cognito) for authentication. Here’s a simplified version of my config file:

"use client"
import { Amplify, type ResourcesConfig } from "aws-amplify";

export const authConfig: ResourcesConfig["Auth"] = { Cognito: { userPoolId: String(process.env.NEXT_PUBLIC_USER_POOL_ID), userPoolClientId: String(process.env.NEXT_PUBLIC_USER_POOL_CLIENT_ID), }, };

Amplify.configure({ Auth: authConfig }, { ssr: true });

export default function ConfigAmplifyClientSide() { return null; }

Locally (npm run dev) and even inside my local Docker , everything works fine inside k8s pod, sign-in and Amplify initialization succeed.

However, when we deploy the same project (in a Kubernetes cluster with NGINX reverse proxy, the app loads but crashes in the browser console with errors like:

Uncaught ReferenceError: process is not defined

and when i inspect i find this:

u.binding = function(e) { throw Error("process.binding is not supported") } u.cwd = function() { return "/" } u.chdir = function(e) { throw Error("process.chdir is not supported") }

Using .env with vars like:

NEXT_PUBLIC_USER_POOL_ID=ap-_XXXXXX NEXT_PUBLIC_USER_POOL_CLIENT_ID=YYYYYYYYYY

i am expecting it to work in deployement, just like how it worked inside k8s and localy

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.