Skip to content

fix: patch-package install in docker build and better postgres patch #17523

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

Merged
merged 9 commits into from
Apr 10, 2025

Conversation

bwees
Copy link
Member

@bwees bwees commented Apr 10, 2025

Description

patch-package is not running on the docker build currently. This is due to the check on our post-install script to prevent it from running if a global install is triggered. It turns out that the build is failing on npm link instead of the global install as we previously thought.

This PR promotes patch-package to a normal dependency instead of a dev-dependency so it is able to patch packages when only regular (non-dev) dependencies are installed. In addition, we must also copy the patches folder for the build step to use.

This also adds a check for if query is an object but query.origin does not exist (described here: porsager/postgres#944 (comment)).

Fixes report from discord: https://discord.com/channels/979116623879368755/1359070399916146729/1359701229504303377)

How Has This Been Tested?

I have tested and confirmed that the relevant files are properly patched at the end of the docker build. Still need an action to be run here to confirm the whole pipeline works.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

@bwees bwees requested a review from danieldietzler as a code owner April 10, 2025 15:19
@jrasm91 jrasm91 changed the title Fix patch-package not running on docker build and handle an additional case where query error parser could fail fix: patch-package install in docker build and better postgres patch Apr 10, 2025
@bwees bwees force-pushed the postgres-patch-package-fixes branch from b426f33 to ddf9176 Compare April 10, 2025 16:23
@jrasm91 jrasm91 merged commit 7df2c9c into immich-app:main Apr 10, 2025
40 checks passed
savely-krasovsky pushed a commit to savely-krasovsky/immich that referenced this pull request Jun 8, 2025
…mmich-app#17523)

* always patch package when running npm i, install immich CLI outside of directory so post install doesnt run

* handles case where query is an object and defined but origin is not.

* move patch-package from a dev dependency to a normal dependency. Also copy the patches folder for the docker build to use and patch with

* fix Dockerfile

* use query.reject instead of throw for queryError

* package-lock to reflect the dev dependency change

* dont throw the error, just provide an empty string for query.origin if it does not exist

* remove npm link and demote patch-package back to a dev dependency

* modify patch to add defensive check to catch queries that will fail to parse and reject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants