bmachek/lrc-immich-plugin

[Issue] Bad Argument Error

AngelaDMerkel opened this issue · 19 comments

I am running on the newest 1.1.0 but get an error stating the following: bad argument #1 to '?' (string expected, got nil)

Screenshot 2024-08-28 at 13 46 42

As troubleshooting I have deleted the plugin, restarted Lightroom, and installed both by directly adding to the Application Support and by loading from the Plugin Manager GUI

At what point do you get the error message? What are you trying to to do?
Can you please attach the last 100 lines from your ImmichPlugin.log? (Documents/LrClassicLogs/ImmichPlugin.log)

Sure, I was getting this error on switching to the plugin in menu. It looks like my domain works fine and the API key allows the extension to connect successfully, but once it proceeds to the export stage it crashes. I am attaching my log here
ImmichPlugin.log

Which Immich server version are running?

I upgraded to latest and it still causes a crash, albeit with a different error. Here is the updated log
ImmichPlugin.log

When trying to upload only one asset without any other changes, I get the following error
ImmichPlugin.log

Screenshot 2024-08-28 at 15 44 04

The error varies somewhat every single time I attempt, and the section of the logs claiming network connection lost seems unlikely to me as I am very much connected to the server and I don't otherwise notice any network drops either on my server or personal machine

Your log looks like no request is being successful.
What's odd is:

2024-08-28 14:29:07.8880000+02:00, TRACE	ImmichAPI: Preparing POST request /search/metadata
2024-08-28 14:29:07.9980000+02:00, TRACE	ImmichAPI POST request succeeded: {"message":"Cannot GET /api/search/metadata","error":"Not Found","statusCode":404,"correlationId":"j180xibo"}

The plugin is doing a POST request, and the response states a 404 with method GET. So it looks like the Immich server receives a get request, which is wrong. Is it possible that your Immich server is behind Web application firewall, or do you use a proxy on your client?

As for networkConnectionLost, this is just the "normal" error message from the Lightroom SDK, when somethings goes wrong with PUT multipart request. Forget about that.

For now I'm a bit puzzled. But the issue made clear, that the error handling is completely wrong in ImmichAPI, as the log says i.e. POST request succeeded which is wrong. I'll fix that.

I have Immich behind a Cloudflare tunnel, but when I enter the tailscale IP directly it always automatically changes the bare IP to my domain. I don't know how to prevent it from doing that

I have Immich behind a Cloudflare tunnel, but when I enter the tailscale IP directly it always automatically changes the bare IP to my domain. I don't know how to prevent it from doing that

You can manually set your domain to the tailscale ip locally via hosts file ( Linux /etc/host or Windows c:/Windows/system32/drivers/etc/hosts)

I have Immich behind a Cloudflare tunnel, but when I enter the tailscale IP directly it always automatically changes the bare IP to my domain. I don't know how to prevent it from doing that

What about your mobile? I assume you've got the Immich app installed. Which URL do you use there?

I use my domain with the Cloudflare tunnel on the app without issue. At risk of doxing myself, here is a link with what happens

When I enter the Tailscale IP, LR corrects it to utilise my Cloudlare tunnel as opposed to wireguard and I can't stop it

OK, thanks for the link.
You ran into a bug there, which makes it impossible to change the URL in 1.1.0. (Just figured that out right now) This is already fixed in the main branch

The next release will be out in a couple of days. In the meantime you could use the 1.0.0 release.

@bmachek Thanks for taking all your time to work through this. I'll wait until the next release and if this is solved, I will close the issue so that you know.

There are still errors with uploading that now I suspect have to do with Tailscale as I can successfully use the Tailscale IP. I don't know the cause. Included are the LR error and the log file
Screenshot 2024-09-02 at 21 11 56

ImmichPlugin.log

Same error, yes. Do you run your Immich server in your homelab? Can you try to upload at home directly via the LAN IP?

The problem with Tailscale seems to be, that all non GET requests are rewritten to GET, which the Immich server rejects with a 404.

I don't run Immich in my homelab unfortunately, and I can't open the ports on the network where it is located either. Are both tailscale and cloudflare changing the requests to GET? I doesn't work with either service.

I will take some time this weekend to set up Traefik and see if that remedies the issue, otherwise I can't make use of this for now.

Traefik sounds like a good idea. If it still doesn't work, let me know.

Some additional thoughts on that:

  • Do you use the Immich mobile? Does it work with the Cloudflare tunnel?
  • On your Lightroom machine: Do you connect via some sort of proxy to your Immich instance?

@AngelaDMerkel Any news on that?
I personally switched from a nginx reverse proxy to Cloudflare tunnel, since I find it very useful, but didn't know about it yet. At my instance the plugin works flawlessly with the tunnel.

@AngelaDMerkel Any news on that? I personally switched from a nginx reverse proxy to Cloudflare tunnel, since I find it very useful, but didn't know about it yet. At my instance the plugin works flawlessly with the tunnel.

I haven't been able to find the time to get everything working yet unfortunately, but if you've had success with it, the problem is more than likely mine.

Do you use the Immich mobile? Does it work with the Cloudflare tunnel?

I have immich mobile working successfully with the cloudflare tunnel. So far it's only your add-on which I have had trouble with

Do you connect via some sort of proxy to your Immich instance?

This might be the problem here actually. I tried this both times from my office which is proxied. I will update when I can access an unmonitored network