#Vue Notification Center Error with Status Code 400
1 messages · Page 1 of 1 (latest)
While I generate an answer, here are some sources that might be helpful:
Answer
When you encounter a 400 (Bad Request) error during the session initialization with the Novu notification center component in your Vue project, it often points to an issue with the provided identifiers, such as the subscriber ID or the application identifier. Here are some steps to check and ensure everything is configured correctly:
-
Verify the Application Identifier and Subscriber ID: Ensure that the
applicationIdentifierandsubscriberIdare correctly set in your Vue component. TheapplicationIdentifiershould match the public key available in your Novu dashboard settings, and thesubscriberIdshould ideally be the ID of the logged-in user to see their notifications in the notification center (1) . -
Ensure Environment Variables Are Correctly Set: If you are using environment variables (e.g.,
import.meta.env.NOVU_APP_IDENTIFIER) to store these identifiers, make sure they are correctly set in your.envfile and accessible in your Vue application. You might need to restart your development server for changes to take effect. -
API Key: The API key should not be placed directly in your Vue code for security reasons. The API key is used on the server-side to create subscribers or trigger notifications through Novu's backend SDKs. You do not need to include the API key in your Vue application to use the notification center component (2) .
-
Debugging Initialization: If the notification center still fails to load, double-check the initialization code in your Vue component against the documentation examples to ensure there's no deviation. The documentation provides clear examples of how to set up the notification center component in Vue [(1)](https://docs.novu.co/quickstar
ts/vue#register-the-notification-center-plugin) .
If you've checked these steps and the issue persists, it's possible that there's a specific configuration or compatibility issue with your project setup. Since the error you're encountering is related to the session initialization request to the Novu API, verifying the identifiers and their correct usage in your Vue component is crucial. If the problem doesn't resolve, consider reaching out on the Novu GitHub issues or the community forum for more specific support, as they might need more details about your project setup to diagnose the issue accurately.
Sources
[1] Vue
[2] API key for Novu