Skip to content
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

Issue running migration using mikro-orm: Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string #8130

Closed
intrinsic-blockchain opened this issue Jul 15, 2024 · 2 comments · Fixed by #8131

Comments

@intrinsic-blockchain
Copy link

Bug report

I get the following error:
npx cross-env MIKRO_ORM_CLI=./src/modules/marketplace/migrations-config.ts mikro-orm migration:create
mikro-orm migration:create

Create new migration with current schema diff

Options:
-b, --blank Create blank migration [boolean]
-i, --initial Create initial migration [boolean]
-d, --dump Dumps all queries to console [boolean]
-p, --path Sets path to directory where to save entities [string]
-n, --name Specify custom name for the file [string]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]

Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
at Object.continueSession (C:\Users\hanee\Documents\medusajs\medusa-preview\node_modules\pg\lib\crypto\sasl.js:24:11)
at Client._handleAuthSASLContinue (C:\Users\hanee\Documents\medusajs\medusa-preview\node_modules\pg\lib\client.js:272:18)
at Connection.emit (node:events:514:28)
at Connection.emit (node:domain:489:12)
at C:\Users\hanee\Documents\medusajs\medusa-preview\node_modules\pg\lib\connection.js:117:12
at Parser.parse (C:\Users\hanee\Documents\medusajs\medusa-preview\node_modules\pg-protocol\src\parser.ts:104:9)
at Socket. (C:\Users\hanee\Documents\medusajs\medusa-preview\node_modules\pg-protocol\src\index.ts:7:48)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:343:12)

Describe the bug

Error running migration when trying out the v2 Learning Resource > Marketplace > Vendor recipe
I get Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string when running the following command given in the steps:
npx cross-env MIKRO_ORM_CLI=./src/modules/marketplace/migrations-config.ts mikro-orm migration:create

To be clear I am able to run npx medusa migrations run without any issues

A clear and concise description of what the bug is.

System information

Medusa version (including plugins):
"@medusajs/medusa": "preview"
"cross-env": "^7.0.3"
Node.js version: v20.5.1
Database: Postgres SQL 16
Operating system: Windows 11
Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. Go to (https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/vendors)
  2. At the step https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/vendors#generate-migrations, when running the command npx cross-env MIKRO_ORM_CLI=./src/modules/marketplace/migrations-config.ts mikro-orm migration:create I see the error given above.

Expected behavior

The command should run without errors.

Screenshots

image
image

Code snippets

in src/modules/marketplace/migrations-config.ts

_import { defineMikroOrmCliConfig } from "@medusajs/utils"
import path from "path"
import Vendor from "./models/vendor"
import VendorAdmin from "./models/vendor-admin"

export default defineMikroOrmCliConfig("marketplace", {
entities: [Vendor, VendorAdmin] as any[],
migrations: {
path: path.join(_dirname, "migrations"),
},
})

@thetutlage
Copy link
Contributor

Hey @intrinsic-blockchain

We have pushed a fix hoping that will fix the issue. Meanwhile, can you please explicitly add the following properties to the migrations-config.ts file?

{
  host: "127.0.0.1",
  user: "postgres",
  password: "",
}

@adrien2p
Copy link
Member

This issue should now been solved, also, we have now added the generate option to the migrations cli command, everything should work properly and no more supplemental db will be required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants