YouTrack2YouTrack import does not work: You are not logged in. Follow
Hi.
I am trying to migrate all issues from one YT instance to another.
The import script (https://www.jetbrains.com/help/youtrack/standalone/Import-from-Another-YouTrack-Server.html) fails at "Get issues from 0 to 20":
Get issues from 0 to 20
Cant process issues from 0 to 20
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/youtrackutils/youtrack2youtrack.py", line 422, in youtrack2youtrack
issues = [i for i in sourceg.getIssues(projectId, query, start, max) if len(i.id.split('-')) > 1]
File "/usr/local/lib/python2.7/dist-packages/youtrack/connection.py", line 781, in getIssues
'filter': filter}))
File "/usr/local/lib/python2.7/dist-packages/youtrack/connection.py", line 48, in wrapped
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/youtrack/connection.py", line 154, in _req
raise youtrack.YouTrackException(url, response, content)
YouTrackException: Error for [/issue/byproject/OI?filter=&max=20&after=0]: 401: Unauthorized: You are not logged in.
Traceback (most recent call last):
File "/usr/local/bin/youtrack2youtrack", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/youtrackutils/youtrack2youtrack.py", line 147, in main
project_ids, params=params)
File "/usr/local/lib/python2.7/dist-packages/youtrackutils/youtrack2youtrack.py", line 682, in youtrack2youtrack
raise e
youtrack.YouTrackException: Error for [/issue/byproject/OI?filter=&max=20&after=0]: 401: Unauthorized: You are not logged in.
I tried different source users for the import, but I either
- get "403: Forbidden: You do not have permissions to Benutzer einsehen. You are logged in as XXXX"
- or - when I grant the required permission - the above "401: Unauthorized: You are not logged in."
Please sign in to leave a comment.
Hello,
Could you please share a command you use? The error says you're not authorized to perform the import, please check that the credentials in command are correct and you have enough permissions in both YouTrack servers.
Hi Anastasia,
I'm using the `youtrack2youtrack` command. Since there are mostly credentials in the command I cannot share the full command line.
But I figured out the problem in the meantime:
You have a bug in your import script. My YouTrack is configured to require a login before you can see any issues. Your import script does not login when it queries for the issues on the source server. That explains the "Unauthorized: You are not logged in" response from the server.
I could get around the bug by hacking `youtrack2youtrack.py` directly:
I checked on GitHub to create a pull request, but the source code there is very different.
There is no bug: https://github.com/JetBrains/youtrack-python-scripts/blob/master/youtrackutils/youtrack2youtrack.py#L260
I am no python developer, so I cannot tell you, why I have different code in comparision to GitHub. I followed the instructions on https://www.jetbrains.com/help/youtrack/standalone/Import-from-Another-YouTrack-Server.html and used the command `pip install youtrack-scripts` to get the import scripts.
Additionally to the instructions I figured out one has to `pip install names` so the import script works at all. It uses this library to generate fake usernames.
Hope that helps anyone running into the same problems :-)
Thank you for sharing! I will forward it to the responsible developer.
Just in case, make sure you have the latest version of package installed - run 'pip install -U youtrack-scripts' command.
Hi @anastasia
I am facing the same issues as described here
https://youtrack-support.jetbrains.com/hc/en-us/requests/1889958