inthreedee / photoprism-transfer-album

Transfer a Google Photos album to a new Photoprism album
GNU General Public License v3.0
109 stars 12 forks source link

Failed to get session id, bailing! #6

Closed roofuskit closed 2 years ago

roofuskit commented 2 years ago

I receive the following error when attempting to run the script.

Creating PhotoPrism session...
Failed to get session id, bailing!
roofuskit commented 2 years ago

I just tried with the local URL instead of the external URL and it works fine. Possibly an SSL or reverse proxy issue?

inthreedee commented 2 years ago

The session API is called here: https://github.com/inthreedee/photoprism-transfer-album/blob/4c629370e01aceaecb8ad534f10a818bf57fa7c8/transfer-album.sh#L505-L506

You can manually run that curl command to test it out and see what kind of response you get. $siteURL$sesssionAPI expands to: https://photoprism.example.com/api/v1/session

el-fredo commented 1 year ago

Hello. I am having the same problem. Tried both my internal and external URL.

I run the curl command manually, and I get "error: invalid login credentials". Are apiUsername and apiPassword the same as my standard PhotoPrism credentials? Maybe something has changed since you wrote this script?

I would really appreciate if someone could help me. I've been trying to re-create my Google Photos albums in PhotoPrism for two days now.

inthreedee commented 1 year ago

@el-fredo The API uses your same login info, so it should be working if you can log into the web interface. Make sure you're on a stable release of PhotoPrism. They just released multi-user support so if you were on a preview release or think something went wrong with user migration, there's instructions in the release page to non-destructively clean up/upgrade the user database: https://github.com/photoprism/photoprism/releases/tag/221102-905925b4d

Session and user management have been re-implemented. If you are upgrading from a preview build, you must run the photoprism users reset --yes command in a terminal after the upgrade to recreate the new database tables so that they are compatible with the stable version. This will not affect your pictures or albums.

I'd take a look through the breaking changes on that page and make sure everything is good with your PhotoPrism install. I just imported some more albums myself a few days ago and everything worked fine on my end.

el-fredo commented 1 year ago

Thank you, @inthreedee , for your answer. I am on Build 221105-7a295cab4, which seems to be a stable release. I don't have multi-user support, there is just one user, named "admin".

I am running PhotoPrism as a Docker-Container on Unraid. And I am now wondering if the API-feature is missing here completely? I just saw that there is an additional Container in the Unraid app store called "PhotoPrism-Helper" which is maintained by the user aerilyum in the Unraid community. It adds the following features:

  • Middleware API
  • Web Interface
  • Automation of PhotoPrism features The current main features are API endpoints for importing and indexing content, as well as setting up cron tasks to enable automated importing and indexing.

So when someone goes to the effort to release an additional container with such features, I understand that these features are missing in the "normal" container.

Do you have any idea how I can test if I even can use the API-features? Is there an URL I can call to see this?

inthreedee commented 1 year ago

The command you previously ran and received the invalid login credentials response from is the API. It looks to be working and is telling you that the server has denied your login attempt.

You may only have one user but please read the release notes I linked above. Multi-user support has just been added as a feature and you may need to follow the instructions under "Breaking Changes" to finish migrating your admin user account.

I'm not familiar with the PhotoPrism-Helper container. As far as I know, all those features listed there are available in PhotoPrism by default. It's possible that container has overridden PhotoPrism's default API and is causing conflicts. You may need to ask in that community whether or not this is the case.

The PhotoPrism API docs are here: https://docs.photoprism.app/developer-guide/api/

el-fredo commented 1 year ago

You may only have one user but please read the release notes I linked above. Multi-user support has just been added as a feature and you may need to follow the instructions under "Breaking Changes" to finish migrating your admin user account.

Okay, so I opened the Container-terminal and run the command photoprism users reset --yes After a few seconds, I received

INFO[2022-11-10T11:09:53+01:00] PhotoPrism® needs your support!              
INFO[2022-11-10T11:09:53+01:00] Visit https://photoprism.app/membership to learn more. 
INFO[2022-11-10T11:09:55+01:00] the user database has been recreated and is now in a clean state 
INFO[2022-11-10T11:09:55+01:00] closed database connection  

So I think this problem is solved. But the script is still not working for me.

If I use the Unraid-Terminal, navigate to the folder where the script is located and type sudo sh transfer-album.sh -c /mnt/user/Bilder/Import/config.ini I get the following error:

Import directory not set, using /mnt/user/Bilder/Import
Creating PhotoPrism session...
Failed to get session id, bailing!

If I use the Container-Terminal, I get the following error:

transfer-album.sh: 41: shopt: not found
transfer-album.sh: 44: Syntax error: "(" unexpected
el-fredo commented 1 year ago

I am one step closer by NOT using the Unraid terminal, but instead the container terminal. But first I had to set it to "bash" instead of "shell" in the container settings and restart the container.

Also, I cannot use the config.ini. So my command to run the script is just ./transfer-album.sh and I have to enter URL and login credentials.

Another thing: As URL I can only use the local IP (without http://). So, exactly like this: 192.168.1.103:2342

Now the session is being created, but fails because he cannot find the metadata.json file. That's correct, I am on German language. So I run ./transfer-album.sh -j Metadaten.json

It is still complaining Metadaten.json not found. So I moved everything from /mnt/user/Bilder/Import up to /mnt/user/Bilder/Import/Takeout. But still the same...

inthreedee commented 1 year ago

You can specify the location of the takeout directory using --takeout-dir "/path/to/takeout".

el-fredo commented 1 year ago

I had already tried that, but it didn't work. My problems are probably all Unraid related.

In any case, I have now copied the script one folder higher, i.e. directly into the "Google Photos" folder. And now it works 👍🏼

larionov commented 6 months ago

I just had a similar problem with "Failed to get session id, bailing!" but for me the reason was that I had a quote " character in my password, after changing that it worked.

nar3n12 commented 6 months ago

I am one step closer by NOT using the Unraid terminal, but instead the container terminal. But first I had to set it to "bash" instead of "shell" in the container settings and restart the container.

Also, I cannot use the config.ini. So my command to run the script is just ./transfer-album.sh and I have to enter URL and login credentials.

Another thing: As URL I can only use the local IP (without http://). So, exactly like this: 192.168.1.103:2342

Now the session is being created, but fails because he cannot find the metadata.json file. That's correct, I am on German language. So I run ./transfer-album.sh -j Metadaten.json

It is still complaining Metadaten.json not found. So I moved everything from /mnt/user/Bilder/Import up to /mnt/user/Bilder/Import/Takeout. But still the same...

Thank you, this helped me by using only my localip and port.

xmatthewx commented 5 months ago

I had this failed bailing problem too. I solved it by using localhost:2342 as my URL without http://. Mentioning in case that's helpful to anyone out there who comes along later.