Currently, I am experimenting with Nuxt.js and AWS Amplify to leverage the benefits of SSR/SEO for my project.
I have successfully integrated Amplify into my project and followed the "Manual Configuration" steps outlined in the Amplify Docs to set it up. Additionally, I have managed to implement basic SignUp and SignIn functionalities.
However, upon refreshing the application, I encounter the following error. This issue seems to be related to the SSR functionality of Nuxt, as discussed in an old Stack Overflow thread.
The mentioned thread suggests adding this line:
global.navigator = () => null;
But I am unsure where exactly to include this code snippet.
Error Details:
ReferenceError: navigator is not defined
File: node_modules/@aws-amplify/analytics/dist/aws-amplify-analytics.js
Location in Code (line 38103):
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AWSPinpointProvider');
var RETRYABLE_CODES = [429, 500];
var ACCEPTED_CODES = [202];
var MOBILE_SERVICE_NAME = 'mobiletargeting';
var BEACON_SUPPORTED = navigator && typeof navigator.sendBeacon === 'function'; // events buffer
var BUFFER_SIZE = 1000;
var FLUSH_SIZE = 100;
var FLUSH_INTERVAL = 5 * 1000; // 5s