FAIL api api/src/services/contacts/contacts.test.js (9.325 s)
● contacts › creates a contact
EmailValidationError: Email must be formatted like an email address
14 | export const createContact = ({ input }) => {
> 15 | validate(input.email, 'email', { email: true })
| ^
16 | return db.contact.create({
17 | data: input,
18 | })
at validationError (node_modules/@redwoodjs/api/dist/validations/validations.js:288:9)
at Object.email (node_modules/@redwoodjs/api/dist/validations/validations.js:84:7)
at validate (node_modules/@redwoodjs/api/dist/validations/validations.js:311:26)
at createContact (api/src/services/contacts/contacts.js:15:3)
at api/src/services/contacts/contacts.test.js:29:26
at Object.<anonymous> (node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:163:22)
It seems that validate
is not functioning properly and that is on the API side of Redwood…
is your home route expecting a parameter of email?
How would I check that?
On second thought I think those test errors are to be expected (as I proceeded from the Intermission portion using my own code built from Chapters 1-4…). From the starter docs:
If you continued with your own repo from chapters 1-4, you may see some failures here: we made a lot of changes to the pages, components and cells we generated, but didn’t update the tests to reflect the changes we made.
I’ve run into this same issue and it’s not clear how it should be resolved. I didn’t want to create a new thread, so here it goes.
The project ran fine yesterday. I’m able to build and serve the project but when I run yarn rw dev
I get the following in the console:
web | <e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8910/auth?method=getToken to http://localhost:8911/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors) web | <e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8910/graphql to http://localhost:8911/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors) web | <e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8910/graphql to http://localhost:8911/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)
When I navigate to http://localhost:8910/.redwood/functions/
I get the following:
{"errors":[{"message":"The RedwoodJS API server is not available or is currently reloading. Please refresh."}]}
What happens if you go to http://localhost:8911/graphql ?
Scroll back through your terminal output where you ran yarn rw dev
it sounds like the api server is erroring out and not starting. You should see the error message near the top. So even though the web side is running, and api side isn’t, and you see that message.
For background on 8910 vs 8911: 8910 is the web server, 8911 is the api server. Going to /.redwood/functions on 8910 is really just a proxy for going directly to 8911.
There is no exception thrown after yarn rw dev
.
I get a ton of the following:
api | (node:78514) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
api | (Use node --trace-warnings ...
to show where the warning was created)
api | Building… Took 601 ms
api | Debugger listening on ws://127.0.0.1:18911/d72dd39d-cce5-4357-a627-6f232a85559d
api | For help, see: Debugging - Getting Started | Node.js
api | [addDir]
api | Building… Took 168 ms
api | Debugger listening on ws://127.0.0.1:18911/7c527f43-c623-45ad-8710-cf74dd362a54
api | For help, see: Debugging - Getting Started | Node.js
api | [addDir]
api | Building… Took 191 ms
It appears something is stopping the API from starting properly. I’m not able to navigate to the provided API link.
That ‘[addDir]’ line jumps out to me as it keeps running these lines until I stop the process.
Any thoughts?
@sykespro It has been a hot minute since I dealt with this error. So, I cannot be 100% sure if this is how I cleared it or not but if you check out this thread I had an issue with yarn rw dev
back in RW 0.37
that I resolved by running the following:
yarn --force
then re-ran yarn rw dev
and the same error I first reported popped up again…
So, I ran git clean -fdx -e .env
then yarn install
This cleared up a different error message when running yarn rw dev
and I honestly cannot remember if I did this to clear up this error message I experienced in May and that you are now experiencing… but at the very least it may be worth a shot.
This helped me with this error!
It seemed to pop up for me as I got Vercel Serverless functions working, but I was also adding Pre-rendering to some pages so not really sure when yarn rw dev stopped functioning correctly.
Testing webhooks is hard haha so I was mostly deploying to production to see how things were actually coming through live.
After a week or so as I came back to some front-end, yarn rw dev gave the error described here:
The RedwoodJS API server is not available or is currently reloading. Please refresh.
error across graphQL items.
Redwood 3.2
MacOS Monterey 12.6 on MBP M1 Pro