#Error while running migrations script

1 messages · Page 1 of 1 (latest)

velvet cosmos
#

Hi all - I am getting this error running the sales channels migration script

node ./node_modules/@medusajs/medusa/dist/scripts/sales-channels-migration.js

to upgrade medusa

I put the TYPEORM env variables as stated in the upgrade guide. It seems Heroku postgres refuses the connection because it's not encrypted.

Any idea how to go through that ?

error: no pg_hba.conf entry for host "XXXX", user "XXXXX", database "XXXXXX", no encryption at Parser.parseErrorMessage (/tmp/build_90d8f339/node_modules/pg-protocol/dist/parser.js:287:98) at Parser.handlePacket (/tmp/build_90d8f339/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/tmp/build_90d8f339/node_modules/pg-protocol/dist/parser.js:39:38) at Socket.<anonymous> (/tmp/build_90d8f339/node_modules/pg-protocol/dist/index.js:11:42) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { length: 174, severity: 'FATAL', code: '28000', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'auth.c', line: '545', routine: 'ClientAuthentication' }

velvet cosmos
#

it seems that putting ?sslmode=no-verify allows to pass that

#

however I got a second error now

` > medusa migrations run && node ./node_modules/@medusajs/medusa/dist/scripts/sales-channels-migration.js

   query: SELECT * FROM current_schema()
   query: SHOW server_version;
   query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'migrations'
   query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'typeorm_metadata'
   query: SELECT * FROM "migrations" "migrations" ORDER BY "id" DESC
   {"level":"info","message":"Migrations completed.","timestamp":"2023-02-28 12:59:29"}
   query: SELECT * FROM current_schema()
   query: SHOW server_version;
   query: START TRANSACTION
   query: SELECT store.default_sales_channel_id FROM "store" "store"
   {"level":"error","message":"The default sales channel does not exists yet. Run your project and then re run the migration.","timestamp":"2023-02-28 12:59:31"}

-----> Build failed`

#

"The default sales channel does not exists yet. Run your project and then re run the migration"

#

It says to re-run migrations but that's what I am doing just above - I tried re-run it but I still got the same issue

velvet cosmos
#

Does the migration script for sales channels take into account the case where I have multiple stores in my db ?

I am wondering because looking at the store collection, it seems the migration filled well the first store with the right default_sales_channel_id but not the other ones.