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

Mongoose and Promise Error #55

Open
vigilanteRk opened this issue Jun 11, 2019 · 5 comments
Open

Mongoose and Promise Error #55

vigilanteRk opened this issue Jun 11, 2019 · 5 comments

Comments

@vigilanteRk
Copy link

Issue 1:
[0] (node:3752) UnhandledPromiseRejectionWarning: MongoNetworkError: connection 5 to cluster0-shard-00-02-bioze.mongodb.net:27017 closed
[0] at TLSSocket. (E:\Home\server\node_modules\mongodb-core\lib\connection\connection.js:352:9)
[0] at Object.onceWrapper (events.js:277:13)
[0] at TLSSocket.emit (events.js:189:13)
[0] at _handle.close (net.js:597:12)
[0] at TCP.done (_tls_wrap.js:388:7)
[0] (node:3752) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Issue 2:
[1] When specified, "proxy" in package.json must be a string.
[1] Instead, the type of "proxy" was "object".
[1] Either remove "proxy" from package.json, or make it a string.
[1] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[1] npm ERR! [email protected] start: react-scripts start
[1] npm ERR! Exit status 1
[1] npm ERR!
npm ERR! Failed at the [email protected] start script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! C:\Users\Samsung user\AppData\Roaming\npm-cache_logs\2019-06-11T06_44_18_943Z-debug.log
[1] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[1] npm ERR! [email protected] client: npm run start --prefix client
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the [email protected] client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Samsung user\AppData\Roaming\npm-cache_logs\2019-06-11T06_44_18_975Z-debug.log
[1] npm run client exited with code 1

I found a post on stackoverflow solution regarding the proxy issue, that says to create a separate setupProxy.js file and apply proxy in below way
const proxy = require('http-proxy-middleware');
module.exports = function(app) {
app.use(proxy('/auth/google',
{ target: 'http://localhost:5000' },
"/api/*", {
"target": "http://localhost:5000"
}
));
}
and delete the proxy from client/package.json,
But this remains a temprory solution, and often the error appears regular

Issue 3:
http://localhost:5000/api/current_user
the page remains totally blank, no current user is shown

@dhuang612
Copy link

first error white list your ip address from your mongodb cluster.
The setting is under security

Yes the setupProxy.js is the accepted solution. there is a text document update inside of the course

@vigilanteRk
Copy link
Author

first error white list your ip address from your mongodb cluster.
The setting is under security

Yes the setupProxy.js is the accepted solution. there is a text document update inside of the course

Big THANKS:
It really worked.
But now I'm facing a problem in Heroku deployment, and heroku logs shows chunk of errors, and on heroku server it shows: Cannot GET /

@dhuang612
Copy link

can you post a screenshot of the errors Heroku is showing you?

@vigilanteRk
Copy link
Author

can you post a screenshot of the errors Heroku is showing you?
Thanks for replly:

image

image

image

@dhuang612
Copy link

So I don't see the repo under your account, is it a private one?

I took a look at the error messages, it looks like something under the options to build out the create-react-app is failing

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

No branches or pull requests

2 participants