Datasource Fails to Work After Updating Config Settings (503)

Hiya!

I am in the process of building a backend datasource plugin for a custom system we have. The plugin is bare-bones and works initially. However, there are two configuration options implemented that when updated they result in a failed datasource test (returns a 503: service unavailable) and the datasource becomes unusable. It will only work again if a new datasource is created to replace the original one.

This is my first time dealing with frontend stuff and JS/TS. I’m sure I’ve implemented these options wrong somehow.

All the fields are setup in the types.ts file properly AFAICT. My guess is modifying these two fields prevents the datasource backend from reloading, however I’m not really sure why or even how to check this. The resulting error message is meaningless (“testing failed”).

Would this be an issue primarily with the Go backend or the TS frontend? The frontend config entries are setup as follows:

    onRemoteLookupChange = (event: ChangeEvent<HTMLInputElement>) => {
        const { onOptionsChange, options } = this.props;
        const jsonData = {
          ...options.jsonData,
          remoteLookup: event.target.checked,
        };
        onOptionsChange({ ...options, jsonData });
      };

      onResponseMaxChange = (event: ChangeEvent<HTMLInputElement>) => {
        const { onOptionsChange, options } = this.props;
        const jsonData = {
          ...options.jsonData,
          responseMax: parseInt(event.target.value),
        };
        onOptionsChange({ ...options, jsonData });
      };


    <div className="gf-form-inline">
              <div className="gf-form">
                <Switch
                  label="Remote Lookup"
                  size={60}
                  span={8}
                  checked={jsonData.remoteLookup as boolean}
                  onChange={onUpdateDatasourceJsonDataOption(this.props, 'remoteLookup')}
                />
                <FormField
                  label="Response Max"
                  labelWidth={6}
                  inputWidth={20}
                  value={jsonData.responseMax || ''}
                  onChange={onUpdateDatasourceJsonDataOption(this.props, 'responseMax')}
                />
              </div>
            </div>

Would appreciate any help in debugging this and finding the problem, thanks!