How can I connect sidechain signal to AudioProcessorGraph?

I am a beginner at JUCE and trying to make a sidechain compressor.
Following this JUCE tutorial(JUCE: Tutorial: Cascading plug-in effects
),
I tried to connect nodes to get a buffer from the Sidechain signal but I cannot get any signals from the sidechain bus.

Could someone help me?

I set buses properties like the following code.

TestAudioProcessor::DuckerAudioProcessor()
     : AudioProcessor (BusesProperties()
                       .withInput("Input", juce::AudioChannelSet::stereo(), true)
                       .withOutput("Output", juce::AudioChannelSet::stereo(), true)
                       .withInput("Sidechain", juce::AudioChannelSet::stereo(), true)),
        mainProcessor(new juce::AudioProcessorGraph())
                    
{
}

And I created nodes and connected them at the main prepareToPlay function.

The following code is how I created nodes.

    mainProcessor->clear();
    
    //Create nodes
    
    audioInputNode = mainProcessor->addNode(std::make_unique<AudioGraphIOProcessor>(AudioGraphIOProcessor::audioInputNode));
    audioOutputNode = mainProcessor->addNode(std::make_unique<AudioGraphIOProcessor>(AudioGraphIOProcessor::audioOutputNode));
    
    CompressorProcessorNode = mainProcessor->addNode(std::make_unique<CompressorProcessor<float>>());
    

Then I connected them together.

    for (int channel = 0; channel <2; ++channel)
    {
        mainProcessor->addConnection ({ { audioInputNode->nodeID,  channel },
                                        { CompressorProcessorNode->nodeID, channel } });
        
        mainProcessor->addConnection ({ { CompressorProcessorNode->nodeID, channel },
                                        { audioOutputNode->nodeID, channel } });
        
        //sideChain signal
        mainProcessor->addConnection ({ { audioInputNode->nodeID,  channel+2 },
                                        { CompressorProcessorNode->nodeID, channel +2 } });
    }

Is something wrong with me?
Thank you.

My guess is that the AudioProcessorGraph needs to be informed about the number of inputs and outputs it should have. You could try calling mainProcessor->setPlayConfigDetails (4, 2, sampleRate, blockSize) during the prepareToPlay of the DuckerAudioProcessor, and before creating the node connections. It’s probably also a good idea to check the result of addConnection and to output some debugging text if adding the connection fails.