Open Closed

Uncaught TypeError: Cannot read properties of undefined (reading 'users') #2453


User avatar
0
AlderCove created
  • ABP Framework version: v5.1.1 & 5.1.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:

jquery.js?_v=637774598147390000:4059 Uncaught TypeError: Cannot read properties of undefined (reading 'users') at HTMLDocument. (chatMessageReceiving…2743500000000:12:31) at mightThrow (jquery.js?_v=637774598147390000:3766:29) at process (jquery.js?_v=637774598147390000:3834:12)

  • Steps to reproduce the issue:"
  1. Create a new application
  2. Add the Chat module
  3. run the application
  4. enable Chat feature
  5. open developer tools
  6. refresh the page
  7. view the developer tools console


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Try to add ChatProxyScriptContributor("/client-proxies/chat-proxy.js")

    public class ChatProxyScriptContributor : BundleContributor
    {
        public async override Task ConfigureBundleAsync(BundleConfigurationContext context)
        {
            var featureChecker = context.ServiceProvider.GetService<IFeatureChecker>();
    
            if (await featureChecker.IsEnabledAsync(ChatFeatures.Enable))
            {
                context.Files.AddIfNotContains("/client-proxies/chat-proxy.js");
            }
        }
    }
    
    
    Configure<AbpBundlingOptions>(options =>
    {
        options.ScriptBundles
                .Get(StandardBundles.Scripts.Global)
                .AddContributors(typeof(ChatGlobalScriptContributor), typeof(ChatProxyScriptContributor ));
    });
    
  • User Avatar
    0
    AlderCove created

    Thanks.

    That fixed the problem, but is this a bug and should the script contributor be automatically configured by way of my Web module having a dependency on the ChatWebModule?

    Or, is this the typical approach for making the module scripts available in the Web projects?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    We fixed it in the next version.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38