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

Abierto
#6,953 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TSQL
Estrellas
32
Forks
7
Merge medio
1 d 16 h
PR fusionados (30 d)
504

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MemberJunction/MJ

Todos los issues de MemberJunction/MJ

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.