Umbraco Engage (Headless) - The path in 'value' must start with '/'

Hello. I am exploring Umbraco Engage in its headless state, with an Umbraco backend and an SSR Nuxt frontend.

When using $fetch to GET from e.g./umbraco/engage/api/v1/segmentation/assets/item/{path}a reoccuring error appears:
An unhandled exception was thrown by the application.
System.ArgumentException: The path in ‘value’ must start with ‘/’. (Parameter ‘value’).
It does however also happen when using the Swagger endpoints, not only when called from the frontend.

I am at my wits end - has anyone experienced this, or have an idea why it’s happening ?

Hi @viktorhafdal,

Could you let me know what the exact version is of Umbraco & Umbraco Engage that you are using?

Could you also share the exactly request you are sending to said API endpoint?

Kind regards,

Corné

Hi @cornehoskam. Thanks so much for replying.

Regarding versions:

  • Umbraco.Cms v13.8.1

  • Umbraco.Engage& Umbraco.Engage.Headless both v13.5.3

    Additional info, don’t know if it’s needed:

  • Umbraco.Cms.Api.Delivery v13.8.1

  • Umbraco.Cloud.Cms v13.0.0

It should be noted that Skybrud.Umbraco.Redirects is also used.

As to the request:
If I just launch the Umbraco backend, access the /umbraco/swagger and test the /umbraco/engage/api/v1/segmentation/assets/item/{path}endpoint with path set to: /nyheder/helloworld (which is an actual route that can be accessed), and External-Visitor-Id header set to an actual Visitor Id, I get this (full stack trace can be sent, if necessary):

An unhandled exception was thrown by the application.
System.ArgumentException: The path in ‘value’ must start with ‘/’. (Parameter ‘value’)
at Microsoft.AspNetCore.Http.PathString.FromUriComponent(String uriComponent)
at Microsoft.AspNetCore.Http.PathString.op_Implicit(String s)
at Umbraco.Engage.Headless.Api.v1.Personalization.PersonalizedAssetsApiController.GetAssetsByRoute(String path)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
— End of stack trace from previous location —

Same happens if I attempt a similar call from the frontend to the backend.

Thanks so much for your time.
Kind regards,
Viktor

Hi again @cornehoskam.
Do you have any idea as to what this could be?

The error persists on Engage endpoints:

  • /umbraco/engage/api/v1/segmentation/assets/item/{path}
  • /umbraco/engage/api/v1/segmentation/assets/item/{id}
  • /umbraco/engage/api/v1/segmentation/content/activesegments/{path}
  • /umbraco/engage/api/v1/segmentation/content/activesegments/{id}

Example request that fails (from Swagger):
curl -X 'GET' \ '``https://localhost:44312/umbraco/engage/api/v1/segmentation/assets/item/%2Fnyheder%2Fhelloworld%2F``' \ -H 'accept: application/json' \ -H 'External-Visitor-Id: 46b3b69b-1fc1-4be8-9816-caaae40788f4'

Status 500: An unhandled exception was thrown by the application.
System.ArgumentException: The path in ‘value’ must start with ‘/’. (Parameter ‘value’).

I would dig further into it myself, but since Engage isn’t open source, I’ve kind of reached my investigatory limits >.<’

Hope you can help.
Kind regards,
Viktor

PS.
What I’ve tried:

  • I first suspected it might be an error when requesting root path (‘/’), but after trying paths such as the above, same error was encountered (‘/nyheder/helloworld’)
  • Tried full URL, e.g. http://localhost:3000/nyheder/helloworld. Also fails (makes sense, when the api requests a path, but worth a shot).
  • Dug into the stacktrace to see if anything was leading back to my code, but everything called is Umbraco or Umbraco Engage. Thus leading to me being stuck at not being able to look at the Engage code.
  • Thought it might be a problem with forward slashes not being URL encoded (to ‘%2F’), implemented URL encoding for the paths requested, so the request matched Swagger 1:1. Also fails.
  • Tried requesting paths without leading slash, e.g. nyheder/helloworld, also fails.
  • Tried appending slashes /nyheder/helloworld/ & nyheder/helloworld/, also fails.
  • Tried debugging the frontend, ensuring the path sent is actually what I expect it to be, and matches what the Swagger sends, and it is.
  • When running only the backoffice, and testing on Swagger endpoints it fails.
  • Postman also fails.

Everything has led me to the conclusion that it’s something in the backend that’s failing.

Hi @viktorhafdal,

Unfortunately I seem to be unable to reproduce the issue. All the various endpoints at hand seem to correctly function on a clean install with the latest versions of Engage & Engage Headless 13.5.3.

Have you used an older version of Engage Headless in the past? And if so, can you verify that you are currently using the right .dll files corresponding to the latest version of Engage (aka, no old file remnants are being loaded)

Damn, that’s annoying.

No, Engage has not been install in the project before, but it is an older project, that I am adding Engage onto.
Guess I’ll try and remove and install Engage once again, see if something’s messed up in previous installs.

Thanks for your time and help.

Kind regards,
Viktor