I have a Sitecore Habitat Commerce Instance installed in my machine and everything is working fine.

I would like to extend the ICreateCustomerPipeline to include a block to call my loyalty program. When I tried to register a customer through Sitecore Habitat Commerce registration page, it was able to register the user in Sitecore (have verified in User Manager and Commerce User).

But it would not redirect me to the account page (Without the custom block, it is able to redirect me after registration complete). No error is thrown in Sitecore CD and Commerce Authoring log.

My questions - How do we troubleshoot Sitecore SXA component if the log does not contain any relevant error?

Below is my block code (the issue still persist even I remove all the logic in this block)

public override async Task<Customer> Run(Customer arg, CommercePipelineExecutionContext context)
    context.Logger.LogInformation("Running Customers.CreateLoyaltyCustomerBlock");

    Condition.Requires(arg).IsNotNull($"{this.Name}: The argument can not be null");

    string baseUri = @"http://localhost:8080";
    string merchantId = @"00004";
    string createUserUri = baseUri + @"/users";

    var createUserhttpWebRequest = (HttpWebRequest)WebRequest.Create(createUserUri);
    createUserhttpWebRequest.ContentType = "application/json";
    createUserhttpWebRequest.Method = "POST";

    using (var streamWriter = new StreamWriter(createUserhttpWebRequest.GetRequestStream()))
        string json = "{" +
                              "\"email\": \"" + arg.Email + "\"," +
                              "\"enabled\": true," +
                              "\"merchant_id\": \""+ merchantId + "\"," +
                              "\"name\": \"" + arg.Name + "\"," +
                              "\"password\": \"\"," +
                              "\"user_id\": \"" + arg.Id + "\"," +
                              "\"user_type\": \"\"" +


    var httpResponse = await createUserhttpWebRequest.GetResponseAsync();
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
        var result = streamReader.ReadToEnd();
        context.Logger.LogInformation("Creating loyalty customer result: " + result);

        //var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(result);

    return arg;

Below is my ConfigureSitecore code (which is similar to Sitecore.HabitatHome.Feature.ProductKit.Engine)

var assembly = Assembly.GetExecutingAssembly();

services.Sitecore().Pipelines(config => config
       .ConfigurePipeline<ICreateCustomerPipeline>(builder => builder.Add<CreateLoyaltyCustomerBlock>().After<CreateCustomerBlock>())
       .ConfigurePipeline<IConfigureServiceApiPipeline>(configure => configure.Add<ConfigureServiceApiBlock>()));

  • Did you try invoking the CreateCustomer functionality through postman? I don't see any issues with the block, so I wonder what the difference in response is.
    – Jonne Kats
    Dec 7, 2018 at 6:45

1 Answer 1


I opened up the customer plugin dll using reflector and the CreateCustomerBlock code is hardly human readable. Based on the code in CreateCustomerBlock, I suspected that the redirection is performed within the CreateCustomerBlock.

To test this assumption, I modified the block sequences by including my block before the CreateCustomerBlock.

Voila, it works .. Looks like I will need to raise a Sitecore support on this how to decouple CreateCustomerBlock functionality into multiple small blocks.

var assembly = Assembly.GetExecutingAssembly();

    services.Sitecore().Pipelines(config => config
       .ConfigurePipeline<ICreateCustomerPipeline>(builder => builder.Add<CreateLoyaltyCustomerBlock>().Before<CreateCustomerBlock>())
       .ConfigurePipeline<IConfigureServiceApiPipeline>(configure => configure.Add<ConfigureServiceApiBlock>()));

  • Nice catch! Please accept your answer. Jan 7, 2019 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.