Skip to content

Commit fc53879

Browse files
authoredApr 26, 2021
Fix: Object Destructuring Error (#24397)
According to the official Next.js documentation on [Environmental Variables](https://nextjs.org/docs/basic-features/environment-variables): > `process.env` is not a standard JavaScript object, so you’re not able to use object destructuring. Environment variables must be referenced as e.g. `process.env.NEXT_PUBLIC_PUBLISHABLE_KEY`, not `const { NEXT_PUBLIC_PUBLISHABLE_KEY } = process.env`. <!-- Thanks for opening a PR! Your contribution is much appreciated. In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes
1 parent cac9ccf commit fc53879

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎examples/with-mongodb-mongoose/utils/dbConnect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import mongoose from 'mongoose'
22

3-
const { MONGODB_URI } = process.env
3+
const MONGODB_URI = process.env.MONGODB_URI
44

55
if (!MONGODB_URI) {
66
throw new Error(

0 commit comments

Comments
 (0)
Please sign in to comment.