Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to make traceContext of common/trace public? #1676

Open
mzeiher opened this issue Feb 24, 2025 · 2 comments
Open

Is it possible to make traceContext of common/trace public? #1676

mzeiher opened this issue Feb 24, 2025 · 2 comments

Comments

@mzeiher
Copy link

mzeiher commented Feb 24, 2025

Related issues

-none

[REQUIRED] Version info

node
v21.7.3

firebase-functions:
6.3.1

firebase-tools:
v13.20.2

firebase-admin:

[REQUIRED] Test case

import { onCall } from 'firebase-functions/https';
import { traceContext } from 'firebase-functions/lib/common/trace';

export const callable = onCall((request) => {
  logger.info('Hello from Firebase!');
  // it would be nice to be able to access trace context to use it for adding meta information to firebase documents or forward it if doing specific calls.
  logger.info("traceContext", traceContext);
});

[REQUIRED] Steps to reproduce

firebase deploy

[REQUIRED] Expected behavior

deployment works, and I get trace information.

[REQUIRED] Actual behavior

deployment fails with error

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/common/trace.js' is not defined by "exports" in *************/node_modules/firebase-functions/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:650:9)
    at resolveExports (node:internal/modules/cjs/loader:589:36)
    at Module._findPath (node:internal/modules/cjs/loader:666:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1128:27)
    at Module._load (node:internal/modules/cjs/loader:983:27)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (**************)
    at Module._compile (node:internal/modules/cjs/loader:1368:14) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Were you able to successfully deploy your functions?

no

Alternative

wrap every call in own AsyncLocalStorage and/or use otel and extract traceparent or X-GOOGLE-TRACE header again/by ourself

@google-oss-bot
Copy link
Collaborator

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@CorieW
Copy link

CorieW commented Feb 25, 2025

Hi @mzeiher,

Thanks for reporting this issue! We’ve received it and are reviewing it. We’ll provide updates as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants