Medusa crashes after migration to Metal

akomis
PRO

a month ago

This error occured after upgrading to Metal.
It seems that there is an issue with the Postrges database which this service interacts with through Typeorm.
The error points to the PaymentProvider with error TypeORMError: Empty criteria(s) are not allowed for the update method.

The payment provider table seems fine but the logs of postgres service mention a weird interruption.

database system was interrupted; last known up at 2025-05-25 18:39:30 UTC database system was not properly shut down; automatic recovery in progress

I am wonderingg if the state of everything can be recovered before the migration?

Manually setting everything to leggacy doesnt fix the issue.

Solved$10 Bounty

5 Replies

lofimit
HOBBYTop 10% Contributor

a month ago

I think it means that somewhere in your code, TypeORM is trying to run an update() query without awhereclause, which is now considered invalid behavior in newer versions of TypeORM.


akomis
PRO

a month ago

The thing here is that the code never changed, medusa and dependency versions never changed everything was running as expected before migrating to Metal.


akomis

The thing here is that the code never changed, medusa and dependency versions never changed everything was running as expected before migrating to Metal.

lofimit
HOBBYTop 10% Contributor

a month ago

Hmm... can you try to manually SELECT everything from the table, and then manually insert something into the table the way ur software is supposed to be doing?
If it works, then it's an issue laying somewhere on your code.


akomis
PRO

a month ago

Interacting with the database works okay but everything seems to point to the Postgres service beingg mirated to Metal and some sort of corruption happening, I attach the logs here:

2025-05-25 20:57:37.743 UTC [28] LOG: database system was interrupted; last known up at 2025-05-25 20:23:47 UTC

2025-05-25 20:57:37.882 UTC [5] LOG: database system is ready to accept connections

2025-05-25 20:57:37.823 UTC [28] LOG: database system was not properly shut down; automatic recovery in progress

2025-05-25 20:57:37.829 UTC [28] LOG: redo starts at 0/5CFA138

2025-05-25 20:57:37.829 UTC [28] LOG: invalid record length at 0/5CFA220: expected at least 24, got 0

2025-05-25 20:57:37.829 UTC [28] LOG: redo done at 0/5CFA1E8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s

2025-05-25 20:57:37.842 UTC [26] LOG: checkpoint starting: end-of-recovery immediate wait

2025-05-25 20:57:37.873 UTC [26] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.009 s, sync=0.004 s, total=0.036 s; sync files=2, longest=0.003 s, average=0.002 s; distance=0 kB, estimate=0 kB; lsn=0/5CFA220, redo lsn=0/5CFA220


akomis
PRO

a month ago

You were right there was a breaking change with TypeORM sorry for the hussle.


Status changed to Solved chandrika about 1 month ago