https://github.com/phstc/cognito-amplify-cdk-10290
https://github.com/phstc/cognito-amplify-cdk-10290
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/phstc/cognito-amplify-cdk-10290
- Owner: phstc
- Created: 2023-03-29T20:21:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T23:17:57.000Z (about 3 years ago)
- Last Synced: 2025-04-07T15:42:00.637Z (about 1 year ago)
- Language: TypeScript
- Size: 840 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Sample repo for troubleshooting [Next.js and AWS Amplify "No current user" at getServerSideProps - REST, not GraphQ](https://github.com/aws-amplify/amplify-js/issues/10290)
### Set up
```sh
cd backend
npm install
```
- Make sure you have a valid [GITHUB_TOKEN](https://github.com/phstc/cognito-amplify-cdk-10290/blob/ccea786393e9addc6c71ff846b144a4fd77db245/backend/src/infra/app-stack.ts#L93) secret.
- Set a unique domain for your Cognito user pool [here](https://github.com/phstc/cognito-amplify-cdk-10290/blob/ccea786393e9addc6c71ff846b144a4fd77db245/backend/src/infra/auth-stack.ts#L57).
- Update the frontend Amplify configuration [here](https://github.com/phstc/cognito-amplify-cdk-10290/blob/ff2330b94138ca31f8e2b223c270d91e58c4dcae/frontend/src/configure-amplify.ts#L29) to use the same unique domain
```sh
npm run deploy
```
Once the deployment is completed, get the output from the deployment (or check them on the Amplify deployed app/Environment variables) and configure [env.local.sample](https://github.com/phstc/cognito-amplify-cdk-10290/blob/5a82b49ed775319d7575211b58d5a022f38fb2c5/frontend/env.local.sample) with the deploy output values then rename the file to `env.local`.
```sh
mv frontend/env.local.sample frontend/env.local
```
Install frontend dependencies:
```sh
cd frontend
npm install
```
### Running
```sh
cd frontend
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) there will be two links:
- [Works SSR](http://localhost:3000/works-ssr)
- [Does not work SSR](http://localhost:3000/does-not-work-ssr)