Shopify / shopify-app-template-remix

327 stars 137 forks source link

Not working to change SQLite to MongoDB #354

Closed larrycenter2006 closed 4 months ago

larrycenter2006 commented 1 year ago

In my schema.prisma file I have made some changes as per the Shopify and prisma documentation

datasource db { provider = "mongodb" url = env("DATABASE_URL") }

generator client { provider = "prisma-client-js" }

model Session { id String @id @default(auto()) @map("_id") @db.ObjectId shop String state String isOnline Boolean @default(false) scope String? expires DateTime? accessToken String userId Int? }

and when access "npm run dev" i get Error: The "mongodb" provider is not supported with this command. I mention that I made the .env correctly (mongodb atlas).

Where do I go wrong in setting up new databases or where is the problem?

adventuretocode commented 10 months ago

@larrycenter2006 I have the same error when I am try to run the app with the npm run dev

larrycenter2006 commented 10 months ago

@larrycenter2006 I have the same error when I am try to run the app with the npm run dev

See this link https://github.com/Shopify/shopify-app-template-remix/issues/285#issuecomment-1700603930

nickseth71 commented 7 months ago

I have the same issue when I try to run the app with the npm run dev.

image

nickseth71 commented 7 months ago

I have the same issue when I try to run the app with the npm run dev.

image

Please refer to this link for the Solution https://github.com/Shopify/shopify-app-template-remix/issues/285#issuecomment-1700603930

lizkenyon commented 4 months ago

Hi folks 👋

Glad that the commenter was able to explain what the issue was.

We have updated our readme's with some information about this and linking to the Prisma documentation about the configuring MongoDB.

dkalariya commented 3 months ago

when im try to run my shopify app using this command:shopify app dev --tunnel-url=https://b96e-180-211-99-158.ngrok-free.app:4400 .giving error like Error: The "mongodb" provider is not supported with this command after im converting the sqlLite to mongodb databse .for more info im atteched scrennshot of my error below ![Uploading Screenshot from 2024-06-19 11-48-03.png…]()

lizkenyon commented 3 months ago

@dkalariya Please review our documentation.

filipre commented 2 months ago

Hi @lizkenyon,

I found the documentation quite confusing it might be outdated, too. I'd like to update the Readme (see https://github.com/Shopify/shopify-app-template-remix/pull/764). The following solution works for me:

Update the shopify.web.toml file and modify the predev and dev command to

[commands]
predev = "npx prisma generate && npx prisma db push"
dev = "npm exec remix vite:dev"

The Problem

npm run dev and shopify app dev fail with the message

Error: The "mongodb" provider is not supported with this command.

Proposed Solution 1: ❌

See this link https://github.com/Shopify/shopify-app-template-remix/issues/285#issuecomment-1700603930

Please refer to this link for the Solution https://github.com/Shopify/shopify-app-template-remix/issues/285#issuecomment-1700603930

tells you

You have to update the predev command in package.json. Since mongo is not a relational database the migrate command is going to fail. So to sync the schema with the db you can run npx prisma db push or add it the predev command in package.json scripts.

This is not true because package.json uses the shopify-cli that is responsible for executing

[commands]
dev = "npx prisma generate && npx prisma migrate deploy && npm exec remix vite:dev"

So adding/changing predev in the package.json will still execute shopify app dev executing npx prisma migrate deploy and resulting in the original issue

Proposed Solution 2: ❌

@dkalariya Please review our documentation.

which forwards you to

MongoDB does not support the prisma migrate command. If you are using MongoDB please see the Prisma documentation for more information.

which tells you

No support for Prisma Migrate Currently, there are no plans to add support for Prisma Migrate as MongoDB projects do not rely on internal schemas where changes need to be managed with an extra tool. Management of @unique indexes is realized through db push.

okay, but it doesn't tell how to fix it for Shopify apps