Activities of "wazbek"

Managed to sort this out by adding this to the EntityFrameworkCoreModule.cs file

options.AddDefaultRepositories(includeAllEntities: true);

Hi

I managed to find an issue on the server side by looking at the logs. My services are not being resolved. See error below.

I have placed my Hub class in my Application.csproj. I know the docs recommend either web or api projects but I need to get the IHubContext in my application service to be able to send data back to the hub.

This is what I would like to achieve. Angular frontend communicates to the hub. The hub then calls to my application service and from there I want to be able to send data back to the Angular frontend using the IHubContext.

I have had a look at the SignalRTieredDemo application and I see that the hub is in the Web project and there is a ReceivedMessageEventHandler that handles an event that gets published from the ChatAppService.

Do I need to stick to this architecture or is there another way for me to get this to work as described above?

Would I also need to use the event bus to publish events from my hub to my application service rather than injecting my application service directly into the hub? I am currently getting this error when injecting the application service into my hub:

2020-08-03 08:13:22.994 +02:00 [ERR] Error when dispatching 'OnConnectedAsync' on hub.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating NexModule.Cmt.IdmHub -> NexModule.Cmt.IdmEngineService -> NexModule.Cmt.Services.IdmBidAndAskDataDomainService -> NexModule.Cmt.Services.IdmTradingIntervalDataDomainService -> NexModule.Tsam.TsamInterconDomainService.
 ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'NexModule.Tsam.TsamInterconDomainService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Volo.Abp.Domain.Repositories.IRepository`2[NexModule.Tsam.Domain.TsamInterconCapacity,System.Int32] interconCapacityRepository' of constructor 'Void .ctor(NexModule.Tsam.IInterconDapperRepository, Volo.Abp.Domain.Repositories.IRepository`2[NexModule.Tsam.Domain.TsamInterconCapacity,System.Int32])'.
   at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(ConstructorInfo[] availableConstructors, IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubActivator`1.Create()
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnConnectedAsync(HubConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnConnectedAsync(HubConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)

Thanks.

Hi

I have checked the docs, samples and also the support site but have not found anything documented about the Abp signalR integration on the Angular side.

What do I need to do to get this to work? My code is below.

Thanks,

Warick

  • ABP Framework version: v3.0.4
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): Identity Server Separated
  • Exception message and stack trace: Access to XMLHttpRequest at 'https://localhost:44336/signalr-hubs/idm/negotiate?negotiateVersion=1' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow- Origin' header is present on the requested resource.
  • Steps to reproduce the issue:
import { Injectable } from '@angular/core';
import * as signalR from '@microsoft/signalr';
import { environment } from '@nexweb/core';
import { IdmManagement } from '../models/idm.models';

@Injectable({
  providedIn: 'root'
})
export class IdmHubService {
  private hubConnection: signalR.HubConnection;
  private idmHubUrl = '/signalr-hubs/idm';
  public hubConnectionEstablished = false;

  constructor() {
    this.buildConnection();
    this.startConnection();
  }

  private buildConnection() {
    this.hubConnection = new signalR.HubConnectionBuilder()
      .withUrl(environment.apis.default.url + this.idmHubUrl)
      .build();
  }

  private startConnection() {
    this.hubConnection
      .start()
      .then(() => {
        this.hubConnectionEstablished = true;
      })
      .catch(err => {
        console.error('Error while starting connection: ' + err);
      });
  }

Hi Mehmet

Thanks for taking a look. Your recommendation pointed me in the right direction and I managed to find what was causing the issue.

I started by importing everything into my app module again like this:

imports: [
    BrowserModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    ThemeSharedModule.forRoot({
      httpErrorConfig: {
        errorScreen: {
          component: HttpErrorComponent,
          forWhichErrors: [401, 403, 404, 500],
          hideCloseIcon: true,
        },
      },
    }),
    CoreModule.forRoot({
      environment,
    }),
    AccountConfigModule.forRoot({ redirectUrl: '/' }),
    IdentityConfigModule,
    LanguageManagementConfigModule,
    SaasConfigModule,
    AuditLoggingConfigModule,
    IdentityServerConfigModule,
    TextTemplateManagementConfigModule,
    SettingManagementConfigModule,
    NgxsModule.forRoot([]),
    SharedModule,

    ...(environment.production ? [] : LOGGERS),

Which got my application working witout any errors. I then started moving them one by one to my shell module file that i sent you and I then realised the NgxsModule.forRoot([]) import. I was importing the NgxsModule like this in my core module:

export const ngxsConfig: NgxsModuleOptions = {
  //developmentMode: !environment.production,
  selectorOptions: {
    suppressErrors: false,
    injectContainerState: false
  }
};

@NgModule({
  imports: [
    CommonModule,
    NgxsModule.forRoot([], ngxsConfig),
    NgxsFormPluginModule.forRoot(),
    NgxsReduxDevtoolsPluginModule.forRoot({ disabled: environment.production }),
    ...(environment.production ? [] : LOGGERS)
  ]
})
export class CoreModule {

The NgxsModuleOptions that I had set will only be used in NGXS v4. I removed the ngxsConfig from my NgxsModule import and everything works as expected now. https://www.ngxs.io/advanced/options. This was working before ABP version 2.8.

Sorry for waisting your time.

Thanks again.

Hi Mehmet

Yes we did, we used ABP Suite 2.8 to do the update.

We are using an nx workspace(https://nx.dev/angular/getting-started/why-nx) so our app.module.ts file does not have all the modules imported like a normal angular app. I have follow the order of module imports in our nx workspace by looking at a newly created angular application using abp version 2.8.

I will email the files to info@abp.io.

Hi

  • ABP Framework version: v2.8.0

  • UI type: Angular

  • Tiered (MVC) or Identity Server Seperated (Angular):
    Identity Server Not Separated (Angular)

  • Exception message and stack trace:

    core.js:6210 ERROR TypeError: Cannot read property 'objectExtensions' of undefined
      at ɵ1 (volo-abp.commercial.ng.ui.js:3358)
      at wrappedSelectorFn (ngxs-store.js:2865)
      at memoized (ngxs-store-internals.js:59)
      at selectFromRoot (ngxs-store.js:2901)
      at ngxs-store.js:2896
      at Array.map (<anonymous>)
      at MapSubscriber.selectFromRoot [as project] (ngxs-store.js:2892)
      at MapSubscriber._next (map.js:29)
      at MapSubscriber.next (Subscriber.js:49)
      at StateStream._subscribe (BehaviorSubject.js:14)
    

    also warnings in the browser

    Could not find localization source: TextTemplateManagement   abp-ng.core.js:1014
    
    The localization source separator (::) not found.  abp-ng.core.js:1014
    

    All the abp screens are displaying like this too:

  • Steps to reproduce the issue: We are getting some errors after updating to version 2.8. We updated our aspnetcore to 2.8 using ABP suite 2.8. We also update our ABP/Volo packages in our angular application to 2.8.0. We then ran the application and we receive the above errors on application startup.

Hi

We are getting some errors after updating to version 2.8. We are using the Angular frontend.

This error happens when the app loads up:

core.js:6210 ERROR TypeError: Cannot read property 'objectExtensions' of undefined
    at ɵ1 (volo-abp.commercial.ng.ui.js:3358)
    at wrappedSelectorFn (ngxs-store.js:2865)
    at memoized (ngxs-store-internals.js:59)
    at selectFromRoot (ngxs-store.js:2901)
    at ngxs-store.js:2896
    at Array.map (<anonymous>)
    at MapSubscriber.selectFromRoot [as project] (ngxs-store.js:2892)
    at MapSubscriber._next (map.js:29)
    at MapSubscriber.next (Subscriber.js:49)
    at StateStream._subscribe (BehaviorSubject.js:14)

There are also these warnings in the browser console:

Could not find localization source: TextTemplateManagement   abp-ng.core.js:1014

The localization source separator (::) not found.  abp-ng.core.js:1014

All the abp screens are displaying like this too:

Thank you.

Hi Mehmet

Thanks. I am already protecting my routes with the AuthGuard.

Any idea when this fix will be released?

HI

I try to browse to a page on our website, say /setting-management but I am not logged in yet. I get redirected to the /account/login screen as expected. I then login but I am not redirected back to the /setting-management page which I first navigated to.

I had a look at the AuthGuard and found this line of code router.navigate(['/account/login'], { state: { redirectUrl: state.url } });

How can I get this to work as expected?

Showing 21 to 30 of 54 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11