-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't restore a google account #38
Comments
@toddb Did you manage to find a workaround for this? I'm also struggling with the same issue. Thanks |
I have just looked at the scripts/project I used for the migration. It was all pretty awful and too embarrassing to post here! It is undocumented with commented out code and looks for practical purposes one-off (although looking at it I kept running it over a period of time of the migration). I have put in some effectively pseudo code to help. It was painful. From what I can tell.
Good luck. #!/usr/bin/env bash
set -e
# generate restore json files for each environment
node ./node_modules/.bin/cbr backup -r ap-southeast-2 -p default --pool ap-southeast-2_src --dir .
node ./node_modules/.bin/cbr backup -r ap-southeast-2 -p default --pool ap-southeast-2_dest --dir .
# diff the two files to return on non-google with an email address (note: not using phone)
node ./diff.js
# add new addresses without google
node ./node_modules/.bin/cbr restore \
--pwdModule ./cognito-migrate/pwd_module.js \
--file to_add_cognito.json \
-r ap-southeast-2 \
-p default \
--pool ap-southeast-2_dest const fs = require('fs');
export function readPool(poolId) {
const data = fs.readFileSync(__dirname + '/ap-southeast-2_' + poolId + '.json');
return JSON.parse(data);
}
const src = readPool('ap-southeast-2_src');
const dest = readPool('ap-southeast-2_dest');
let emailPredicate = x => x.Attributes.filter(x => x.Name === 'email')[0].Value;
const prodEmails = dest.map(x => emailPredicate(x));
const nonGoogleAccounts = src.filter(x => !x.Username.includes('google'));
const toAddCognito = nonGoogleAccounts.filter(x => !prodEmails.includes(emailPredicate(x)))
fs.writeFileSync(__dirname + '/to_add_cognito.json', JSON.stringify(toAddCognito)); |
I am doing some migrations. All was good until I hit a
google_xxx
account. I haven't been able to locate the error. Is it possible? Links to documentation would be great.Note: I am raising it here because these value came out of a backup and then I tried to restore and can imagine other people having this problem. In practice what happens is that the non external accounts (ie cognito) restore but it is very hard to notice this.
My assumption is that either we need to strip values of external accounts on restore or setup the pool differently. The former seems more probable because I don't/can't change my pool without deleting it.
UPDATE: Looking at linking cognito user to federated accounts it would seem that it is not surprising we can't out of the box.
General Settings > Attributes
Federation > Google > Attribute mapping
Here's my script, sample json from a backup and the error message.
The text was updated successfully, but these errors were encountered: