Expand my Community achievements bar.

adobe aem model manager prepending /null in request url

Avatar

Level 1

Hi Team,

 

I gave a react app which has static folder. this static folder has a subfolder named js and within that i have my model.json file. this static folder is being served by out by nginx server when we make request for the path js/ .

so in our code we have modelmanager.initialize('js/model.json'). but when i see the request uri. i can see along with window.location.origin there is /null getting added between this path im giving in initialize and window.location.origin. for example say i have my window.location.origin something like this https://test.com/abc/def. but when i see model.json get request in network tab, the request url is https://test.com/abc/def/null/js/model.json. can you please help me on this.

1 Reply

Avatar

Moderator

@adithyake 

Here's a breakdown of the problem in simpler terms:

  • Unexpected "/null" in URL: When a React app tries to fetch a file called "model.json" using a specific path, an extra "/null" is getting added to the URL unexpectedly, making it incorrect and preventing the file from being retrieved successfully.

  • File Location and Requesting Code:

    • The "model.json" file is located within a "js" subfolder within a "static" folder in the React app.
    • The code is using modelmanager.initialize('js/model.json') to initiate the retrieval of the file.
  • Serving Server and Actual Request URL:

  • Key Question: The issue lies in understanding why this "/null" is being incorrectly inserted into the request URL and how to fix it.

Please let me know if the understanding is correct?