User Import Failed

I have exported users from one of my tenant as a .json file using User Import / Export Extension and tried to import to another tenant . But got email saying “Failed to parse users file JSON when importing users. Make sure it is valid JSON.”

What could be the issue?

:wave: @tvbishan did you by any chance open the exported JSON before importing the users? It’s possible it may have changed the file encoding. Other cases I’ve seen certain fields being converted to strings instead of being objects that caused the upload to fail. Example, user_metadata field was a string, where it should have been an object.

These are all speculation and simply based on cases Ive seen in the past. I would need a bit more information to pinpoint the cause for you. Which browser are you using? Are you able to reproduce this? If it is possible to share the JSON file you are trying to upload I could take a look (please feel free to DM me the file).

1 Like

:wave: @kimcodes Thanks for your response. Yeah, First time I did open the exported JSON and look at it before importing the users. But second time I didn’t open the file before importing. Result was same.

The exported JSON looks like below. (this is a sample data set. actual file has more fields than this like app_metadata, identities etc…)

{"user_id":"auth0|dfjksd4r4545","nickname":"demo","name":"demo@example.com","email":"demo@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}
{"user_id":"auth0|dfjksd4r5545","nickname":"demo2","name":"demo2@example.com","email":"demo2@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}
{"user_id":"auth0|dfjksd4r4565","nickname":"demo3","name":"demo3@example.com","email":"demo3@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}

So I have modified file as below…

[{"user_id":"auth0|dfjksd4r4545","nickname":"demo","name":"demo@example.com","email":"demo@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}, {"user_id":"auth0|dfjksd4r5545","nickname":"demo2","name":"demo2@example.com","email":"demo2@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}, {"user_id":"auth0|dfjksd4r4565","nickname":"demo3","name":"demo3@example.com","email":"demo3@example.com","last_ip":"xxx.xxx.xxx.xxx","last_login":"2018-07-19T14:45:11.532Z","logins_count":228}]

…and re upload. This time upload succeeded. BTW, some data was missing like last_ip, last_login, logins_count.

Also, The biggest problem is I can’t login with these imported users. When I am trying to login, I am getting error as

WRONG EMAIL OR PASSWORD

What could be the issue?

The upload is completed, but check for warnings - this appears to be a bug because the above schema is different from what Auth0 expects when importing - Bulk User Import Database Schema and Examples. I made the same change as you did; the job completed with 30 warnings (the amount of users I had). It turned out that non of the users were imported because of the different schema.

Furthermore after reading the document above it became clear that you cannot import the user_id which makes the whole export/import procedure useless (we rely on the user_id to map auth0 users to our own users).

What is more is that the exported JSON is not a valid JSON at all…

Add to that the fact that the users should reset their passwords because these cannot be exported for security reasons.

There should be a better way to migrate users from one tenant to another…

1 Like

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?