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.

KeyFilename credentials not copied in internal config #1048

@Christo676

Description

@Christo676

My problem is when i tried to switch from version 3.6.1 to 4.0.0 I cannot trace anymore because of a 403 when I'm publishing my traces. I did some digging in your code and I found out that in your index.js you guys did a massive change on how you copy the user defined configuration to your internal configuration to setup the tracing. In my project i'm using a keyFilename as authentication/authorization, but it is not copied over!

Before you guys where doing

	 // Configuration order of precedence:
    // 1. Environment Variables
    // 2. Project Config
    // 3. Environment Variable Set Configuration File (from GCLOUD_TRACE_CONFIG)
    // 4. Default Config (as specified in './config')
    const config = extend(true, { [util_1.FORCE_NEW]: projectConfig[util_1.FORCE_NEW] }, config_1.defaultConfig, envSetConfig, contextHeaderBehaviorUnderride, projectConfig, envConfig, { plugins: {} });
    ...

    //and you where returning the object config directly
    return config;

At first, you where returning the object config directly which was properly transferring everything....now you guys do

// Configuration order of precedence:
    // 1. Environment Variables
    // 2. Project Config
    // 3. Environment Variable Set Configuration File (from GCLOUD_TRACE_CONFIG)
    // 4. Default Config (as specified in './config')
    const mergedConfig = extend(true, {}, config_1.defaultConfig, envSetConfig, userConfig);
    ...

    //here!!! you return another object the takes parts of the mergeConfig....which cause the missing properties
     return {
        [util_1.FORCE_NEW]: forceNew,
        enabled: mergedConfig.enabled,
        logLevel: util_1.lastOf(mergedConfig.logLevel, Number(process.env.GCLOUD_TRACE_LOGLEVEL)),
        clsConfig: {
            [util_1.FORCE_NEW]: forceNew,
            mechanism: getInternalClsMechanism(mergedConfig.clsMechanism),
        },
        writerConfig: {
            [util_1.FORCE_NEW]: forceNew,
            projectId: util_1.lastOf(mergedConfig.projectId, process.env.GCLOUD_PROJECT),
            onUncaughtException: mergedConfig.onUncaughtException,
            bufferSize: mergedConfig.bufferSize,
            flushDelaySeconds: mergedConfig.flushDelaySeconds,
            stackTraceLimit: mergedConfig.stackTraceLimit,
            maximumLabelValueSize: Math.min(mergedConfig.maximumLabelValueSize, constants_1.Constants.TRACE_SERVICE_LABEL_VALUE_LIMIT),
            serviceContext: {
                service: util_1.lastOf(mergedConfig.serviceContext.service, process.env.GAE_MODULE_NAME, process.env.GAE_SERVICE),
                version: util_1.lastOf(mergedConfig.serviceContext.version, process.env.GAE_MODULE_VERSION, process.env.GAE_VERSION),
                minorVersion: util_1.lastOf(mergedConfig.serviceContext.minorVersion, process.env.GAE_MINOR_VERSION),
            },
        },
        pluginLoaderConfig: {
            [util_1.FORCE_NEW]: forceNew,
            plugins: Object.assign({}, mergedConfig.plugins),
            tracerConfig: {
                enhancedDatabaseReporting: mergedConfig.enhancedDatabaseReporting,
                rootSpanNameOverride: getInternalRootSpanNameOverride(mergedConfig.rootSpanNameOverride),
                spansPerTraceHardLimit: mergedConfig.spansPerTraceHardLimit,
                spansPerTraceSoftLimit: mergedConfig.spansPerTraceSoftLimit,
            },
        },
        tracePolicyConfig: {
            samplingRate: mergedConfig.samplingRate,
            ignoreMethods: mergedConfig.ignoreMethods,
            ignoreUrls: mergedConfig.ignoreUrls,
            contextHeaderBehavior: mergedConfig.contextHeaderBehavior,
        },
        overrides: {
            tracePolicy: mergedConfig.tracePolicy,
            propagation: mergedConfig.propagation,
        },
    };

you are returning another object which takes some parts of the mergeConfig, which is missing user defined properties...like my keyFilename...for my Authorization

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.priority: p0Highest priority. Critical issue. P0 implies highest priority.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions