oqtane/oqtane.framework

[BUG] Oqtane calls incorrect endpoint to render Custom Module in Interactive Client Site

Closed this issue · 2 comments

Oqtane Info

Version - 5.2.0
Render Mode - Interactive
Interactivity - Client (WebAssembly)
Prerender - No
Database - SQL Server

Describe the bug

In an Interactive Client site (or Auto mode), Oqtane fails to render a custom module because it incorrectly calls the endpoint intended for the HTML module, instead of the appropriate endpoint for the custom module. This results in the custom module's content not being displayed.

Expected Behavior

When rendering content for a custom module, Oqtane should call the correct endpoint associated with that custom module, ensuring the content is rendered as expected.

Steps To Reproduce

  1. Create a custom module Module01 using the Create Module feature in Oqtane v5.2.0, and build it in release mode to generate the ToSic.Module.Module01.1.0.0.nupkg file.
  2. Set up a new site on IIS using Oqtane.Framework.5.2.0.Install.zip with the URL 'https://oqtane-poc340.oqtane.me/'.
  3. Install the ToSic.Module.Module01.1.0.0.nupkg.
  4. Create a new Interactive Client (no prerender) sub-site at 'https://oqtane-poc340.oqtane.me/ia01'.
    image
  5. Create a new page h1 and add a standard HTML module with the title h1.
  6. Create another page h2 and add a standard HTML module with the title h2.
  7. Create a third page m1 and add the custom Module01 with the title m1.
  8. Open the browser's DevTools.
  9. Navigate to h1 and verify that the correct HTML content from the h1 module is displayed on the page. Also, confirm that the correct endpoint (e.g., https://oqtane-poc340.oqtane.me/ia01/api/HtmlText/63?authmoduleid=63) is executed with HTTP status 200.
    image
  10. Navigate to h2 and confirm that the correct HTML content from the h2 module is displayed on the page. Similarly, verify that the correct endpoint (e.g., https://oqtane-poc340.oqtane.me/ia01/api/HtmlText/64?authmoduleid=64) is executed with HTTP status 200.
    image
  11. Navigate to m1 and notice that the Module01 content is missing from the page. The incorrect endpoint (https://oqtane-poc340.oqtane.me/ia01/api/HtmlText/66?authmoduleid=66) is executed, returning a status of 204 No Content.
    image

Anything else?

image

@tvatavuk Thank you for reporting. I believe the following 2 PRs resolve the issues reported related to custom modules running on WebAssembly on Oqtane 5.2.0:

#4540 - the BaseAddress was not being set for the IHttpClientFactory which was introduced in Oqtane 5.2.0 - this was resulting in relative Urls being created (which are obviously invalid in a WebAssembly scenario).

#4541 - the default module template was not registering the Service class in the Client project correctly. In Oqtane 5.2.0 the default module template is using the new "dual service" approach so that it performs optimally on both Server and Client scenarios. The interface for the Service class is in the Shared project and because of this, you cannot use the simplistic IService decorator pattern for service registration (as it assumes the interface and implementation are in the same assembly). Instead you need to use the IClientStartup method to explicitly register the interface and implementation which are located in different assemblies. The default module template has now been updated with these changes and tested with WebAssembly using the Dev branch.

@tvatavuk please see #4565

PR #4541 was not valid as it did not actually include the necessary changes to resolve issue #4537 - this was because the gitignore file was excluding files which should have been included. This PR fixes the gitignore and merges the default module template files which were supposed to be committed in #4541