Open Closed

File property in entity: Failed to load (.razor.js) resource #7478


User avatar
0
mfxws created
  • ABP Framework version: v8.2.0
  • UI Type: Blazor Server
  • Database System: EF Core SQL Server
  • Exception message and full stack trace:

2024-07-09 08:08:40.814 +02:00 [INF] Request finished HTTP/2 GET https://localhost:44330/Files.razor.js - 404 null null 15.1462ms 2024-07-09 08:08:40.814 +02:00 [INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://localhost:44330/Files.razor.js, Response status code: 404 2024-07-09 08:08:40.933 +02:00 [WRN] Unhandled exception rendering component: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Import.Blazor.Pages.Import.Files.OnAfterRenderAsync(Boolean firstRender) in Files.razor.cs:line 92 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) 2024-07-09 08:08:40.951 +02:00 [ERR] Unhandled exception in circuit 'SPI47OU8M20KKQIT1NNoRxAYlRQFhM8MiHTh6JFz--Y'. Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:44330/Files.razor.js at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Import.Blazor.Pages.Import.Files.OnAfterRenderAsync(Boolean firstRender) in Files.razor.cs:line 92 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

  • Steps to reproduce the issue:

I created a new entity with a File property using ABP Suite. When I debug the application the generated razor page .js file could not be found. (The .js file contains the clearInputFiles() method)

For some reason the .js file is not provided by the server during debugging, at least i could not find it when i inspect the sources in the browser. I would expect the file under _content/Namespace.Import.Blazor

app.UseStaticFiles(); is called

Since the entity is located in a separate module (generated with ABP Suite) and a staticwebassets.runtime.json is generated, i also tried

if (builder.Environment.IsDevelopment())     
{   
    builder.WebHost.UseWebRoot("wwwroot");  
    builder.WebHost.UseStaticWebAssets();   
}

but this doesn't make any difference.

Here is the method in Files.razor.cs

protected override async Task OnAfterRenderAsync(bool firstRender)  
{  
    if (firstRender)  
    {  
        _jsObjectRef = await JsRuntime.InvokeAsync("import", "./Files.razor.js");  
        await SetBreadcrumbItemsAsync(); 
        await SetToolbarItemsAsync();  
        await InvokeAsync(StateHasChanged);  
    }  
}

I already tried to change the path to different locations: "./Import/Files.razor.js", "./Pages/Import/Files.razor.js", "./Files.razor.js"

Here is the solution structure

If I publish the app, the file is published too. However I want to have a working solution for debugging too without copying anything manually. Do you have any idea, why this isn't working out of the box?


12 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, we will test and write back asap. Regards.

  • User Avatar
    0
    oyku.erman created
    Support Team

    Hi, I can not reproduce your problem.

    1. I created a Blazor Server project with EfCore SQL Server DB.
    2. I created an entity that has a file property.
    3. I ran the application and there was no problem with Files.razor.js file.

    Are there any specific steps I should follow to reproduce your problem? It will be our pleasure to help you.

  • User Avatar
    0
    mfxws created

    Hi,

    in my case the entity with the file property is located in a separate module, not directly in the main blazor project. (Please see my solution structure above) This is causing the issue.

    Best regards

  • User Avatar
    0
    oyku.erman created
    Support Team

    I tried with separate Auth Server (Tiered project) and still got no errors:

  • User Avatar
    0
    mfxws created

    Tiered projec

    Can you may provide me the solution you tested?

  • User Avatar
    0
    oyku.erman created
    Support Team

    Tiered projec

    Can you may provide me the solution you tested?

    1. I created a Blazor Server project with EfCore SQL Server DB with the Tiered option from ABP Suite 8.2.0 version.
    2. I created an entity that has a file property.

    I did not do anything except these steps.

  • User Avatar
    0
    mfxws created

    I created a module

    and added it to the solution. Within the module I created the entity with the file property.

    I think this is different to the tiered option

  • User Avatar
    0
    oyku.erman created
    Support Team

    Okay, we will try it and then let you know the result as soon as possible.Thank you for your patience.

  • User Avatar
    0
    mfxws created

    Okay, we will try it and then let you know the result as soon as possible.Thank you for your patience.

    Any news about it?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Okay, we will try it and then let you know the result as soon as possible.Thank you for your patience.

    Any news about it?

    Hi, sorry for the late response. We were able to reproduce the problem and created an internal issue for this.

    Your ticket is refunded. Regards.

  • User Avatar
    0
    mfxws created

    Okay, we will try it and then let you know the result as soon as possible.Thank you for your patience.

    Any news about it?

    Hi, sorry for the late response. We were able to reproduce the problem and created an internal issue for this.

    Your ticket is refunded. Regards.

    Do you know when the fix is implemented? Will i receive a notification here?

    Is the fix implemented in 8.2.2? I can't find an related issue in github..

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Okay, we will try it and then let you know the result as soon as possible.Thank you for your patience.

    Any news about it?

    Hi, sorry for the late response. We were able to reproduce the problem and created an internal issue for this.

    Your ticket is refunded. Regards.

    Do you know when the fix is implemented? Will i receive a notification here?

    We fixed the problem and it will be included with the upcoming patch release. Regards.

Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13