Skip to content

Commit

Permalink
build: fix Amazon issue #7098.
Browse files Browse the repository at this point in the history
Use aws-amplify@unstable,
and include global.crypto = require('crypto') at the top of signin modules.

aws-amplify/amplify-js#7098
  • Loading branch information
JimStockwell committed Nov 9, 2020
1 parent 738e8ba commit a52df1d
Show file tree
Hide file tree
Showing 4 changed files with 1,748 additions and 157 deletions.
21 changes: 19 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,33 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@aws-amplify/analytics": "^3.3.10",
"@aws-amplify/api": "^3.0.0",
"@aws-amplify/auth": "^3.0.0",
"@aws-amplify/core": "^3.0.0",
"@aws-amplify/interactions": "^3.0.0",
"@aws-amplify/storage": "^3.0.0",
"@aws-amplify/ui": "^2.0.0",
"@aws-amplify/ui-react": "^0.2.27",
"@aws-amplify/xr": "^2.0.0",
"@babel/core": "*",
"@react-native-community/netinfo": "^5.5.0",
"@testing-library/dom": "^7.26.5",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.1.2",
"@types/aws-serverless-express": "^3.3.3",
"aws-amplify": "^3.3.7",
"amazon-cognito-identity-js": "^4.4.0",
"aws-amplify": "^3.3.8-unstable.2",
"aws-amplify-react": "^4.2.11",
"core-js": "^3",
"crypto-js": "^3.2.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-native": "^0.63.3",
"react-scripts": "^3.4.4",
"react-table": "^7.6.1"
"react-table": "^7.6.1",
"typescript": "^4.0.5"
},
"scripts": {
"start": "react-scripts start",
Expand Down
7 changes: 6 additions & 1 deletion src/BackendApi.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable import/first */
//
// Wrapper for backend API
// (Includes a null version constructor)
//
// BackendApi: Getting things from the backend and presenting it in a convenient way.
//

// needed to fix amplify signin
global.crypto = require('crypto');
import Amplify, { Auth, API } from 'aws-amplify';
import awsconfig from './aws-exports';

Expand Down Expand Up @@ -58,7 +62,8 @@ export default class BackendApi {
try {
await this._auth.signIn(username, password);
} catch (error) {
console.log('error signing in', error);
console.log('Error signing in.');
console.log(error);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/BackendApi.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// import { findAllByAltText } from '@testing-library/react';
// needed to fix amplify signin
global.crypto = require('crypto');
// eslint-disable-next-line import/first
import BackendApi from './BackendApi';

test('setPortfolio reports okay', () => {
Expand Down
Loading

0 comments on commit a52df1d

Please sign in to comment.