Tutorial problem after generating scaffold for post

I am getting an error when following chapter 2 of the tutorial. After running yarn rw g scaffold post and I point the browser to http://localhost:8910/posts I get an error on the page that says ‘Unexpected token ‘R’, “Request is not valid” is not valid JSON’ where the tutorial says I should see ‘No posts yet. Create one?’

I am brand new to redwood’s underlying back end tech, and I am relatively new to back end programming in general. Can someone help point me in the right direction?

It’s probably throwing an error on the API side, which instead of a nicely formatted GraphQL JSON response is probably plain text or HTML. Check the terminal window where yarn rw dev is running, so you see any error messages?

If you don’t you can also try just killing the yarn rw dev process and starting it again.

Thank you for your help. I killed the process and restarted it. Upon going to localhosts/posts the behavior is the same and this is the api side readout:

api | 14:11:28 🌲 incoming request POST xxx /graphql
api | 14:11:28 🐛 Parsing request to extract GraphQL parameters
api | 14:11:28 🌲 request completed 3ms

Couple of things:

  • can you post the output of running yarn rw info
  • post the code from api/src/graphql/posts.sdl.js
  • post the code from api/src/services/posts/posts.js

Thanks for the response. Running yarn rw info solved the problem! Turns out my node version got switched to a more recent version. By running nvm use --lts everything works as expected.