aws-amplify / aws-amplify/docs

upgrade amplify always always has massive breaking changes

Open
#6,647 0 comments 0 reactions 0 assignees View on GitHub
amplify/js amplify/ui
Dominant language
MDX
Stars
506
Forks
1.1k
Avg merge
3h 14m
Merged PRs (30d)
1

Description

**Describe the bug**
A clear and concise description of what the bug is.

```
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Amplify, Auth } from 'aws-amplify';
import { Authenticator } from '@aws-amplify/ui-react';
import { environment } from '../../environments/environment';

export const defaultConfig = {
Auth: {
userPoolId: environment.REACT_APP_USER_POOL_ID,
userPoolWebClientId: environment.REACT_APP_USER_POOL_WEB_CLIENT_ID,
region: environment.REACT_APP_AWS_REGION,
mandatorySignIn: false,

// OPTIONAL - Hosted UI configuration
oauth: {
responseType: 'code', // or 'token', note that REFRESH token will only be generated when the responseType is code
},
},
};

/**
* Ath instance of aws-amplify AuthClass
*/
export const authInstance = Auth;
/**
* AmplifyClass instance of aws-amplify
*/
export const amplifyInstance = Amplify;

/* istanbul ignore next */
export class AmplifyService {
public static authToken = '';
public static userInfo:any = null;
/**
*
* @param config
* default value is set using env variables
* ```
* {
* Auth: {
* userPoolId: environment.REACT_APP_USER_POOL_ID,
* userPoolWebClientId: environment.REACT_APP_USER_POOL_WEB_CLIENT_ID,
* region: environment.REACT_APP_AWS_REGION,
* },
* }
* ```
*/
public static configure = (config = defaultConfig) => {
amplifyInstance.configure(config);
};

public static getAuthHeader = async () => {
const data = await authInstance.currentSession();
this.authToken = `Bearer ${data.getAccessToken().getJwtToken()}`;
return this.authToken;
};

public static getUserAccess = async () => {
const data = await authInstance.currentSession();
const userGroups = data.getAccessToken().payload['cognito:groups'];
return {
userAccess: [...userGroups],
};
};

public static getUserInfo = async () => {
if(!this.userInfo) {
const data = await authInstance.currentAuthenticatedUser();
this.userInfo = {
username: data.username,
email: data.attributes.email,
};
}
return this.userInfo;
};

public static signOut = async () => {
await authInstance.signOut({ global: true });
};
}

export { Authenticator };

```

**To Reproduce**
Steps to reproduce the behavior:
1. use "@aws-amplify/ui-react": "^5.3.1", and "aws-amplify": "^5.3.11",
2. upgrade to "@aws-amplify/ui-react": "^6.0.5", "aws-amplify": "^6.0.6",
3. and everything breaks

**Expected behavior**
Why so many breaking changes with these upgrades. It seems to happen every time and takes hours and hours to fix?
Is there a road-map with depreciation warnings so devs / organizations can work efficiently with your software?
Documentation or upgrade paths would be nice as well. Been searching groups for 6 hours on here and `.payload['cognito:groups']` accessToken? idToken? every post is ancient across the internet.

Contributor guide

Open the contributing guide

Research direction

The issue names no documentation file, test, or entry point. Start by reviewing the supplied migration example and the documented changes between aws-amplify 5.3.11 and 6.0.6 and @aws-amplify/ui-react 5.3.1 and 6.0.5. Done would be a clear upgrade path covering the breaking authentication changes, deprecation guidance, and current access-token examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, react, typescript
Domain
authentication, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.