Because some API calls in Gatsby can take longer to finish than others, every time an API is invoked, the Gatsby bootstrap creates an object called apiRunInstance
to track the call. This object contains the fields listed in Table 14-2.
Field | Description |
---|---|
id | A unique identifier generated based on the type of API invoked |
api | The API being invoked; e.g., onCreateNode |
args | Any arguments passed to api-runner-node ; e.g., an individual Node object |
pluginSource | An optional name assigned to the plugin that originated the invocation |
resolve | The Promise resolve callback to be invoked when the API has concluded its execution |
startTime | The timestamp at which the API invocation was initialized |
span | An OpenTracing span for build tracing |
traceId | An optional argument provided to the object if the API invocation will lead to other API invocations |
NOTE
For more information about the usage of traceId
to await downstream API calls occurring due to the ongoing API invocation resulting in other calls to APIs, consult the Gatsby documentation.
Leave a Reply