Getting "email must be email" error when using apiService.initializeSession
Hi i'm using the ApiService from
@novu/client
package. The code is somewhat like:
And I keep getting the error "email must be an email" even though there is no parameter for email in the method interface.7 Replies
Hi @Tam, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question.
@Tam, you just advanced to level 1!
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* Headless API Reference
* Get Started
* NextJS
* Vue
-----------------------------
Answer
It seems like you're encountering an issue that isn't directly covered in the provided documentation. The error message "email must be an email" typically suggests that somewhere within your application or the Novu setup, there's an expectation for an email field that isn't being properly validated or passed.
Given that
initializeSession
in the @novu/client
should not directly require an email according to the method interface, it's possible that this issue might be linked to underlying configurations or the way subscriber identifiers are managed in your system. Here are a few checks you can perform:
1. Verify Subscriber Configuration: Ensure that the subscriberId
being passed does not mistakenly contain or expect an email. Sometimes, systems use emails as subscriber identifiers without proper format validation.
2. Check Integration Points: If your application integrates with other services or databases that handle user data, ensure that email fields are correctly handled and validated before they are passed to Novu's APIs.
3. Review API Version: Ensure that you are using the correct version of the @novu/client
package as per the Novu documentation. Sometimes, errors like these can stem from version mismatches where method expectations might differ.
Since the issue isn't directly addressed in the available documents, you might also consider reviewing recent changes in your codebase that could affect how user data is managed or validate the data flow leading up to the session initialization.
For detailed debugging, consider logging the values received by your application at various stages or enabling more verbose error handling around the API call to capture more specific diagnostics.
Got it. Tagging @Support for additional help.I found the issue, it was a bug with Novu when LOGGING_LEVEL is set to debug
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
@Tam its a bit strange, I could not reproduce this issue
I am facing the same issue. At the time of initialisation we are getting "email must be an email" response with 400 status code
Request payload:
{"applicationIdentifier":"REDACTED","subscriberId":"xyz9473233009845","hmacHash":null}
version : 0.24 (self hosted)
@Pawan Jain