Tencent/WeKnora · error

WeKnoraCloud appID is required

Error message

WeKnoraCloud appID is required

What it means

Constructor guard NewWeKnoraCloudSignedDocumentReader rejects an empty appID — the WeKnoraCloud document reader cannot sign requests without it, so construction fails immediately rather than at first use.

Source

Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:38

)

const (
	weKnoraCloudReaderBaseURL = "https://weknora.weixin.qq.com/api/v1/doc"
)

// WeKnoraCloudSignedDocumentReader implements the docreader HTTP protocol with WeKnoraCloud signing.
type WeKnoraCloudSignedDocumentReader struct {
	appID               string
	apiKey              string
	client              *http.Client
	initialPollInterval time.Duration
	maxPollInterval     time.Duration
	pollTimeout         time.Duration
}

func NewWeKnoraCloudSignedDocumentReader(appID, apiKey string) (*WeKnoraCloudSignedDocumentReader, error) {
	if appID == "" {
		return nil, fmt.Errorf("WeKnoraCloud appID is required")
	}
	if apiKey == "" {
		return nil, fmt.Errorf("WeKnoraCloud apiKey is required")
	}
	clientCfg := secutils.DefaultSSRFSafeHTTPClientConfig()
	clientCfg.Timeout = 500 * time.Minute
	return &WeKnoraCloudSignedDocumentReader{
		appID:               appID,
		apiKey:              apiKey,
		initialPollInterval: 500 * time.Millisecond,
		maxPollInterval:     10 * time.Second,
		pollTimeout:         20 * time.Minute,
		client:              secutils.NewSSRFSafeHTTPClient(clientCfg),
	}, nil
}

func (p *WeKnoraCloudSignedDocumentReader) Reconnect(addr string) error {
	return nil

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Provide the WeKnoraCloud appID from configuration
  2. Check env/secret injection for an empty value
  3. Fail datasource setup early with a clear config error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/infrastructure/docparser/weknoracloud_http_reader.go:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/aabd1ee529fc4298. Report an issue: GitHub.