Code Errors ,Help!

I see some errors in the code ,how to fix it?
My website ( www.strongbanner.com/home ) load extremely slow , over 15seconds! I think this errors could be the reason ,or other?
:camera:
https://gyazo.com/94e0612172e267e73fdcf3e2b525c15e

I see some require code lines in your code and that wouldn’t be supported in Wix Code at this moment. Please paste your code in here and select it and mark it as code so I can see it, the screenshot is a bit small.

1 Like

This is “Typeerror” code.

"use strict";

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

Object.defineProperty(exports, "__esModule", { value: true });

var _require = require('../services/chat-event-emitter.service'),
    chatEventEmitter = _require.chatEventEmitter,
    CHAT_EVENTS = _require.CHAT_EVENTS;

var app_service_1 = require("../services/app-service");

var _require2 = require('../constants/bi-logger.config'),
    EVENTS = _require2.EVENTS;

var isInfiniteListExperimentOn = function isInfiniteListExperimentOn() {
    var _require3 = require('../index'),
        chatSdk = _require3.chatSdk,
        Constants = _require3.Constants;

    return chatSdk.isExperimentOn(Constants.experiments.ChatlistInfiniteScrollInCrazyChatClient);
};

var ServerApi = function () {
    function ServerApi(chatAgent) {
        _classCallCheck(this, ServerApi);

        this.chatAgent = chatAgent;
    }

    _createClass(ServerApi, [{
        key: "http$fetchChatrooms",
        value: function http$fetchChatrooms() {
            var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
                nextPointer = _ref.nextPointer,
                _ref$pageSize = _ref.pageSize,
                pageSize = _ref$pageSize === undefined ? isInfiniteListExperimentOn() ? 20 : 100 : _ref$pageSize,
                isArchived = _ref.isArchived;

            return this.chatAgent.get('chatrooms-for-list-view', { nextPointer: nextPointer, pageSize: pageSize, archived: isArchived, lastMessageLimit: 10 }).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$fetchRoomMessages",
        value: function http$fetchRoomMessages(_ref2) {
            var chatroomId = _ref2.chatroomId,
                cursor = _ref2.cursor;

            return this.chatAgent.get("chatrooms/" + chatroomId + "/messages", { pageSize: 50, nextPointer: cursor }).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$fetchRoom",
        value: function http$fetchRoom(_ref3) {
            var chatroomId = _ref3.chatroomId;

            return this.chatAgent.get("chatrooms/" + chatroomId).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$setMessagesRead",
        value: function http$setMessagesRead(_ref4) {
            var chatroomId = _ref4.chatroomId,
                lastReadMessageSequence = _ref4.lastReadMessageSequence;

            return this.chatAgent.put("chatrooms/" + chatroomId + "/users", { lastReadMessageSequence: lastReadMessageSequence }).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$deleteChatroom",
        value: function http$deleteChatroom(_ref5) {
            var chatroomId = _ref5.chatroomId;

            return this.chatAgent.zdelete("chatrooms/" + chatroomId).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$archiveChatroom",
        value: function http$archiveChatroom(_ref6) {
            var chatroomId = _ref6.chatroomId;

            return this.chatAgent.put("chatrooms/" + chatroomId + "/archive").then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$unarchiveChatroom",
        value: function http$unarchiveChatroom(_ref7) {
            var chatroomId = _ref7.chatroomId;

            return this.chatAgent.put("chatrooms/" + chatroomId + "/unarchive").then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$initRealtimeToken",
        value: function http$initRealtimeToken(chatToken) {
            return this.chatAgent.post("real-time-tokens", { token: chatToken }).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$sendMessage",
        value: function http$sendMessage(chatroomId, message) {
            message.createdAt = message.createdAt || Date.now();
            var type = message.type,
                sender = message.sender,
                id = message.id;

            chatEventEmitter.emit(CHAT_EVENTS.BI, _extends({}, EVENTS.sendMessage, {
                messageId: id,
                chatRoomId: chatroomId,
                messageType: type,
                uuid: sender.userId,
                mimeType: message.mimeTypes,
                hostName: app_service_1.default.appName
            }));
            return this.chatAgent.post("chatrooms/" + chatroomId + "/messages", message.dto).then(function (response) {
                return response.data;
            });
        }
    }, {
        key: "http$fetchCurrentUserDisplayData",
        value: function http$fetchCurrentUserDisplayData() {
            return this.chatAgent.get('display-data/current-user').then(function (response) {
                return response.data.content;
            });
        }
    }, {
        key: "http$notifyTyping",
        value: function http$notifyTyping(chatroomId, eventType, expiryDuration) {
            return this.chatAgent.post("chatrooms/" + chatroomId + "/typing-events", { type: eventType, expiryDuration: expiryDuration }).then(function (response) {
                return response.data;
            });
        }
    }]);

    return ServerApi;
}();

exports.default = ServerApi;

This is “XML Parsing Error: no root element found
Location: https://engage.wixapps.net/_api/auto-messages-server/v1/auto-messages/trigger?token=JWS.eyJraWQiOiJsZlRKZFBWUyIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1widmlzaXRvcnNJbnN0YW5jZUlkXCI6XCJlZjgzNWQ2Zi1mODMwLTQ5YzctYmZhNS0xMWNlOWU4M2U3YzdcIixcImNoYXRyb29tSWRcIjpcImFlYzA5ODQwLTFiMWYtMzdhYy05ZDEzLWE3YWE1ZDdhZTA3MVwiLFwiY29udGFjdElkXCI6XCIxMDc4NDc0YS1iMzIxLTRiODgtOTZmMC1mYzdmZDg0MmMyN2NcIixcIm1lc3NhZ2VUeXBlXCI6XCJHUkVFVElOR1wifSIsImlhdCI6MTUyNjM2NjUyOH0.ZigWKVJEllk6akqQtUEIOl6sRSpw8JLJQsz1zkb2MFE
Line Number 1, Column 1:” error

 <!--  -->   <!doctype html> <!--     --> <html ng-app="wixErrorPagesApp"> <head>  <meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, user-scalable=no">  <meta charset="utf-8">  <meta http-equiv="X-UA-Compatible" content="IE=edge">  <title ng-bind="'page_title' | translate"></title>  <meta name="description" content="">  <meta name="viewport" content="width=device-width">  <meta name="robots" content="noindex, nofollow">  <link type="image/png" href="//www.wix.com/favicon.ico" rel="shortcut icon">  <link href="//static.parastorage.com/services/third-party/fonts/Helvetica/fontFace.css" rel="stylesheet" type="text/css" />  <!--  -->  <link rel="stylesheet" href="//static.parastorage.com/services/wix-public/1.235.0/styles/error-pages/styles.css">  <!--  --> <script type="text/javascript" src="https://ff.kis.v2.scr.kaspersky-labs.com/9227ED43-628B-1E47-8EF8-E9EA11B94154/main.js" charset="UTF-8"></script></head> <body lang="en" ng-controller="ErrorPageController as errorPageCtrl" class="error-page-app" ng-class="{'secondary-background': isSecondaryBackground}"> <!--[if lt IE 9]> <script src="//static.parastorage.com/services/third-party/es5-shim/2.1.0/es5-shim.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <![endif]--> <!--[if gte IE 9]><!--> <script src="//static.parastorage.com/services/third-party/jquery/2.0.3/jquery.min.js"></script> <!--<![endif]-->  <script src="//static.parastorage.com/services/third-party/angularjs/1.2.28/angular.min.js"></script>  <!--  --> <script src="//static.parastorage.com/services/third-party/angularjs/1.2.28/i18n/angular-locale_en.js"></script> <script src="//static.parastorage.com/services/third-party/angular-translate/1.1.1/angular-translate.min.js"></script>  <script src="//static.parastorage.com/services/wix-public/1.235.0/scripts/error-pages/locale/messages_en.js"></script>  <!--  --> <script src="//static.parastorage.com/services/wix-public/1.235.0/scripts/error-pages/app.js"></script>  <!--  -->  <script>   angular.module('wixErrorPagesApp').constant('staticsUrl', '//static.parastorage.com/services/wix-public/1.235.0/');   angular.module('wixErrorPagesApp').constant('baseDomain', 'wix.com');   angular.module('wixErrorPagesApp').constant('language', 'en');   angular.module('wixErrorPagesApp').constant('errorCode', {code: '405'});   angular.module('wixErrorPagesApp').constant('data', {});   angular.module('wixErrorPagesApp').constant('exceptionName', '');   angular.module('wixErrorPagesApp').constant('serverErrorCode', '405'); </script> <div ng-cloak ng-include="errorPageCtrl.errorPageUrl">  <div class="non-angular-supported-browser-wrapper">  <h1 class="non-angular-supported-browser-header">Error 405 occurred</h1>  <div class="non-angular-supported-browser-link">  <span>Regardless, we recommend you to <a href="http://browsehappy.com/">update your browser.</a></span>  </div>  </div> </div> <!-- verification --> <!-- end verification --> </body> </html> 

The error " Loading failed for the with source “https://static.parastorage.com/unpkg/promote-analytics-adapter@1.0.78/dist/statics/analytics-event-adapter.bundle.min.js”. "
this code is very long, but if you need, I will post it here.
Thanks!

Hi emil,

You are using features that are not supported in Wix Code.

Read the article Working with JavaScript in Wix Code . Also, take a look at the Wix Code documentation in order to familiarize yourself with Wix Code.

Yisrael

2 Likes