Skip to content

Commit b805911

Browse files
Simplify the README
A smaller README is more likely to focus a developer on whats most important. Therefore: 1. Remove the MongoDB Section and link to the Prisma README instead 2. Move the nbf section above the MongoDB section as its more likely to be applicable.
1 parent 7b4d28a commit b805911

1 file changed

Lines changed: 4 additions & 57 deletions

File tree

README.md

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,6 @@ Embedded apps must maintain the user session, which can be tricky inside an iFra
153153

154154
This only applies if your app is embedded, which it will be by default.
155155

156-
### App goes into a loop when I change my app's scopes
157-
158-
If you change your app's scopes and authentication goes into a loop before failing after trying too many times, you might have forgotten to update your scopes with Shopify. Update your scopes.
159-
160-
Using yarn:
161-
162-
```shell
163-
yarn deploy
164-
```
165-
166-
Using npm:
167-
168-
```shell
169-
npm run deploy
170-
```
171-
172-
Using pnpm:
173-
174-
```shell
175-
pnpm run deploy
176-
```
177-
178156
### Webhooks: shop-specific webhook subscriptions aren't updated
179157

180158
If you are registering webhooks in the `afterAuth` hook, using `shopify.registerWebhooks`, you may find that your subscriptions aren't being updated.
@@ -218,45 +196,14 @@ By default the CLI uses a cloudflare tunnel. Unfortunately cloudflare tunnels w
218196

219197
To test [streaming using await](https://reactrouter.com/api/components/Await#await) during local development we recommend [localhost based development](https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development).
220198

221-
### Using MongoDB and Prisma
222-
223-
By default this template uses SQLlite as the database. It is recommended to move to a persisted database for production. If you choose to use MongoDB, you will need to make some modifications to the schema and prisma configuration. For more information please see the [Prisma MongoDB documentation](https://www.prisma.io/docs/orm/overview/databases/mongodb).
224-
225-
Alternatively you can use a MongDB database directly with the [MongoDB session storage adapter](https://github.com/Shopify/shopify-app-js/tree/main/packages/apps/session-storage/shopify-app-session-storage-mongodb).
226-
227-
#### Mapping the id field
228-
229-
In MongoDB, an ID must be a single field that defines an `@id` attribute and a `@map("\_id")` attribute.
230-
The prisma adapter expects the ID field to be the ID of the session, and not the \_id field of the document.
231-
232-
To make this work add a new field to the schema that maps the \_id field to the id field. For more information see the [Prisma documentation](https://www.prisma.io/docs/orm/prisma-schema/data-model/models#defining-an-id-field)
233-
234-
```prisma
235-
model Session {
236-
session_id String @id @default(auto()) @map("_id") @db.ObjectId
237-
id String @unique
238-
...
239-
}
240-
```
241-
242-
#### Error: The "mongodb" provider is not supported with this command
243-
244-
MongoDB does not support the [prisma migrate](https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/overview) command. Instead, you can use the [prisma db push](https://www.prisma.io/docs/orm/reference/prisma-cli-reference#db-push) command and update the `shopify.web.toml` file with the following commands. If you are using MongoDB please see the [Prisma documentation](https://www.prisma.io/docs/orm/overview/databases/mongodb) for more information.
245-
246-
```toml
247-
[commands]
248-
predev = "npx prisma generate && npx prisma db push"
249-
dev = "npx prisma migrate deploy && npm exec react-router dev"
250-
```
251-
252-
#### Prisma needs to perform transactions, which requires your mongodb server to be run as a replica set
253-
254-
See the [Prisma documentation](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb/connect-your-database-node-mongodb) for connecting to a MongoDB database.
255-
256199
### "nbf" claim timestamp check failed
257200

258201
This is because a JWT token is expired. If you are consistently getting this error, it could be that the clock on your machine is not in sync with the server. To fix this ensure you have enabled "Set time and date automatically" in the "Date and Time" settings on your computer.
259202

203+
### Using MongoDB and Prisma
204+
205+
If you choose to use MongoDB with Prisma, there are some gotchas in Prisma's MongoDB support to be aware of. Please see the [Prisma SessionStorage README](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-prisma#mongodb).
206+
260207
## Resources
261208

262209
React Router:

0 commit comments

Comments
 (0)