menu

JS Everywhere

A community for the JavaScript Everywhere book by Adam Scott, published by O'Reilly.

Channels
Team

Blocked deploying my first jseverywhere application: would appreciate help!

January 23, 2021 at 3:23pm

Blocked deploying my first jseverywhere application: would appreciate help!

January 23, 2021 at 3:23pm
Learning through the beautifully written Javascript Everywhere book - many thanks for that. But at the end of chapter 10, I am getting the following error message that I could not resolve through this support forum. The curl command is a single line. Many thanks!
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ notes { id } }" }' https://jljseverywhere.herokuapp.com/api curl: (6) Could not resolve host: query curl: (3) [globbing] nested brace in column 9 curl: (3) [globbing] unmatched close brace/bracket in column 1 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Bad Request</pre> </body> </html> </body> </html>

January 23, 2021 at 3:46pm
for ease of reading
  • reply
  • like

January 24, 2021 at 2:22am
Hi (jl74400)! I am glad that you are enjoying the book! I was able to successfully make a request to your deployed API with the following command:
  • reply
  • like
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ notes { id } }" }' https://jljseverywhere.herokuapp.com/api
  • reply
  • like
I hope that helps! Congrats on completing the first major chunk of the book
  • reply
  • like

January 24, 2021 at 4:41pm
Dear Adam, first let me thank you very warmly for responding to my question so quickly and on a Saturday at that. This is very impressive and I deeply appreciate the attention! This said, I am getting the same error messages after strictly copy/pasting your command. Could that be because of some settings in my shell (I am using Windows Command Prompt, but I get similar errors from Visual Studio Code's terminal)? At least I am feeling confident to continue down the next chapters of the book, as you are able to get a proper response from my API. Regards.
  • reply
  • like

January 25, 2021 at 2:17pm
Hmm, it is possible that it is a Windows issue. Unfortunately I don't have a Windows machine handy at the moment, but let me know if you run into any new issues!
  • reply
  • like

February 14, 2021 at 8:53pm
Hi Scott, based on your reaching my API, I kept going through the book and built the REACT webapp, pushed it on GitHub and published it on Netifly. The web page displays nicely and does what it should, but the first GraphQL query bounces with "loading" then the "error" message. I'm not sure how to move forward. Any suggestion? Regards.
  • reply
  • like
oops.. i meant Hi Adam 🙊
  • reply
  • like
note that everything works very well on my local machine
  • reply
  • like

February 15, 2021 at 8:39am
note that everything works very well on my local machine
Had a similar error. I was getting a 'dquote>' after running the curl command (mine is a Macbook). But with Paw I did successfully send the request; I guess similar tools like Postman would do too.
Edited
  • reply
  • like

February 16, 2021 at 1:27am
I'm sorry to hear that (jl74400). If you share it here or DM me a link to the app, I can take a look to see if anything sticks out or should be able to give you some advice on how to troubleshoot the cause
  • reply
  • like

February 16, 2021 at 7:30am
Hi Scott, this is really nice of yours. Here is the link to the app: https://jl-notedly-webapp.netlify.app/ and the api at the top of this thread. I am not too sure how to troubleshoot indeed, some help would be welcome! thank you. I can send you a login email and pwd if you need?
  • reply
  • like
It's hard to tell, but it looks like the error that is being returned by the server is "Cannot read property '_id' of undefined." I can't be certain, but that makes me to suspect that it is an error with the MongoDB setup... that could be why it works locally and when attempting to query an empty list of notes but not when fully deployed
  • reply
  • like

February 16, 2021 at 11:02pm
Adam, you mean the deployment of MongoDB Atlas? How did you get that error message, what kind of investigation tools are you using - if accessible to poor layman like me! - ?
  • reply
  • like
Sure thing, I'm using the Firefox Developer Edition browser (though Chrome should have similar functionality). In the Networks tab I can see that the API threw a 500 error. When I double click that error, I can see the full JSON response from the server.
  • reply
  • like
  • reply
  • like
  • reply
  • like
It may also be useful to look at your deployed API's logs, which can be found in the "more" section from the Heroku dashboard
  • reply
  • like

February 17, 2021 at 10:47pm
Funny stuff, I did a lot of testing along the lines you mentioned. Following your suggestion about the DB, I ended up opening MongoDB Compass and connecting to my Atlas database. I saw 2 accounts you created yesterday. I also saw 2 accounts I created today despite getting an error message. But now everything is working fine, all functions are operating and not throwing any error... Thank you Adam for jumping in!
  • reply
  • like

February 18, 2021 at 6:28pm
That is quite the journey! I wish we knew what went wrong, but I'm very glad to hear that everything is working as expected. Thanks for sticking with it!
  • reply
  • like
It might have been a password with improper quotes in an ENV variable, or a bad initial upload into Heroku - as I repushed everything.
  • reply
  • like