Skip to content

Commit 3913e4e

Browse files
authored
Removed duplicate MONGODB_URI check in example (vercel#42518)
This PR removes the duplicate check if the MONGODB_URI environment variable is set.
1 parent dd3e851 commit 3913e4e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

examples/with-mongodb/lib/mongodb.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MongoClient } from 'mongodb'
22

33
if (!process.env.MONGODB_URI) {
4-
throw new Error('Invalid environment variable: "MONGODB_URI"')
4+
throw new Error('Invalid/Missing environment variable: "MONGODB_URI"')
55
}
66

77
const uri = process.env.MONGODB_URI
@@ -10,10 +10,6 @@ const options = {}
1010
let client
1111
let clientPromise: Promise<MongoClient>
1212

13-
if (!process.env.MONGODB_URI) {
14-
throw new Error('Please add your Mongo URI to .env.local')
15-
}
16-
1713
if (process.env.NODE_ENV === 'development') {
1814
// In development mode, use a global variable so that the value
1915
// is preserved across module reloads caused by HMR (Hot Module Replacement).

0 commit comments

Comments
 (0)