Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

GAE with Trace Agent - Error: Creating phantom child span because root span was already closed  #880

@anandnimkar

Description

@anandnimkar

I started to experience this issue on Oct 4, 2018 at around 7:40 PM EDT.

In GCP Stack Driver logging, I am getting the following error message from my node.js app deployed on Google App Engine Standard for Node.

@google-cloud/trace-agent ERROR TraceApi#createChildSpan: [[email protected]:src/client.js] Creating phantom child span [grpc:/google.logging.v2.LoggingServiceV2/WriteLogEntries] because root span [/v1/dialogflow] was already closed.

Note that the traces are still working as expected and I am able to use the trace ID that is generated for the incoming request to GAE to filter all log entries. The only problem is that the trace module is reporting the error above.

Here is my index.ts file, using ES6 on Node 8.

if (process.env.NODE_ENV === "production") {
    require("@google-cloud/trace-agent").start({
        clsMechanism: "async-listener",
    });
} else {
    require("longjohn");
}
require("./app");

I believe the integration with Google App Engine has an issue.

Metadata

Metadata

Assignees

Labels

api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions