Discovery run fails at ConnectionTest on the first run after a restart: per-connection field rows are not loaded

Aperta
#6,953 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Read packages/Integration/engine/src/IntegrationConnectorCreationPipeline.ts, especially runInternal, LoadCatalogScope, and stageConnectionTest, then trace IntegrationEngineBase.GetIntegrationObjectFields and the connection's catalog rows. Reproduce with a connection that has field rows after restarting MJAPI and running discovery before sync. Done when ConnectionTest handles cold per-connection field rows without falsely reporting a connection failure.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version: 6.2.2 (LTS). The same code is on the next branch.

What happens

A discovery run (the connector creation pipeline) fails at the ConnectionTest stage on the first run after the MJAPI process starts. The run fails in some milliseconds and makes no call to the external system. A later run in the same process passes, after a sync of the same connection has run.

Example from a connector that reads the fields of its first object to build a small test query:

ConnectionTest failed: [elevate] The Report API door rejected a minimal query for resource "AccountingCode", and reported no reason.

The message points the operator to the site URL and the API key, but the two are correct.

Cause

In packages/Integration/engine/src/IntegrationConnectorCreationPipeline.ts, runInternal calls LoadCatalogScope and then stageConnectionTest. LoadCatalogScope loads the objects and the dependency edges of the connection. It does not load field rows.

When the connection already has its own catalog rows, the connector gets the connection's own objects inside the scope. In TestConnection the connector calls GetCachedFields for one of these objects. In IntegrationEngineBase.GetIntegrationObjectFields the field rows of that object are not warm, and RequireWarmFields is not set for this scope, so assertWarm does not throw. The function continues to the resident index, which has no rows for a per-connection object id, and returns an empty list.

The connector then has no column to query and reports a failed connection.

Why it does not show on each run

  • A sync calls WarmCatalogObject for each object it reads. The warm rows stay in the process until the row budget removes them. A discovery run that starts after a sync of the same connection finds the rows and passes.
  • A connection with no catalog rows of its own gets the shared declared objects, and their fields are resident.
  • A connector that does not read fields in TestConnection is not affected.

So the failure shows only when a discovery run is the first work for that connection after a restart, or after the rows are removed from the cache.

Steps to reproduce

  • Use a connection that already has rows in CompanyIntegrationObject and CompanyIntegrationObjectField.
  • Use a connector whose TestConnection reads GetCachedFields of an object.
  • Restart MJAPI.
  • Start a discovery run for the connection before a sync of that connection runs.

Suggested correction

  • Before stageConnectionTest, warm the field rows of the object or objects that the connector reads in TestConnection. One option is to warm the first active object of the connection. A second option is to give the connector an async step to name the objects it needs.
  • Or run the ConnectionTest stage with RequireWarmFields set, so a read of cold field rows throws PER_CONNECTION_CATALOG_OBJECT_COLD and does not return an empty list. This makes the cause visible but does not make the test pass.

The same condition applies to the IntegrationTestConnection resolver if it calls TestConnection inside a catalog scope without warm field rows. I did not test that path.

Lingua principale
TSQL
Stelle
32
Fork
7
Merge medio
1g 16h
PR unite (30g)
504

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MemberJunction/MJ

Tutte le issue di MemberJunction/MJ

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.