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

[BUG]: dd-trace throws error for openai integration Cannot read properties of undefined (reading 'context') #5032

Open
SimonFernsR opened this issue Dec 17, 2024 · 1 comment
Labels
bug Something isn't working integration-openai

Comments

@SimonFernsR
Copy link

Tracer Version(s)

5.19.0

Node.js Version(s)

18.20.4

Bug Report

With the dd-trace-js "openai" plugin enabled we get an error thrown when making use of the AzureOpenAI openai initializer.

This only happens when we call this in our sandbox environment, and works perfectly in staging / prod.
I am going to expand this issue over the coming days with more detail, like the re-production code, any references / how it broke for other people and a bit of self investigation.

Reproduction Code

No response

Error Logs

/usr/src/app/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:196
    const error = !!span.context()._tags.error
                         ^

TypeError: Cannot read properties of undefined (reading 'context')
    at OpenApiPlugin.finish (/usr/src/app/node_modules/dd-trace/packages/datadog-plugin-openai/src/index.js:196:26)
    at /usr/src/app/node_modules/dd-trace/packages/dd-trace/src/plugins/tracing.js:76:22
    at Subscription._handler (/usr/src/app/node_modules/dd-trace/packages/dd-trace/src/plugins/plugin.js:14:9)
    at Channel.publish (node:diagnostics_channel:141:9)
    at finish (/usr/src/app/node_modules/dd-trace/packages/datadog-instrumentations/src/openai.js:365:12)
    at /usr/src/app/node_modules/dd-trace/packages/datadog-instrumentations/src/openai.js:331:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AzureChatCompletionService.chatCompletionCall (/usr/src/app/dist/common/services/chat-completion/azure-chat-completion.service.js:26:20)
    at async AzureChatCompletionService.createChatCompletion (/usr/src/app/dist/common/services/chat-completion/azure-chat-completion.service.js:80:24)
    at async TagsIngestionService.generateLLMTagsForPlace (/usr/src/app/dist/services/nlp-search/tags-ingestion-service/tags-ingestion.service.js:142:30)

Operating System

Linux places-service-7fdbbb44c-vw4ft 5.10.225-213.878.amzn2.aarch64 #1 SMP Tue Sep 10 22:02:55 UTC 2024 aarch64 GNU/Linux

Bundling

No Bundling

@SimonFernsR SimonFernsR added the bug Something isn't working label Dec 17, 2024
@sabrenner
Copy link
Collaborator

👋 Hi @SimonFernsR, thanks for opening this issue! I believe this bug was resolved in 5.22.0 - feel free to try that version out and follow up with how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration-openai
Projects
None yet
Development

No branches or pull requests

3 participants