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

lookup function throws The "options.lookup" property must be of type function. Received type string in 4.49.0 #4894

Closed
blemoine opened this issue Nov 15, 2024 · 1 comment · Fixed by #5244

Comments

@blemoine
Copy link
Contributor

blemoine commented Nov 15, 2024

I recently migrated from dd-trace 4.29 to 4.49
I'm using node 22.11.0.

This code:

const ddtrace = require('dd-trace');
const dns = require("node:dns");
const tracer = ddtrace.init({
    serviceName: 'my-service',
    lookup: (...args) => {
        console.log('LOOKUP CALLED');
        return dns.lookup(...args)
    },
    hostname: 'whaafldjslkfds.com',

});


function main() {
    tracer.trace('trace', () => {
            console.log(`TRACED`);
        }
    );
    setTimeout(() => {
        console.log('Time to send the request to the agent')
    }, 2000)
}

main();

Is working and displaying LOOKUP CALLED in 4.29.0, but is throwing
TypeError [ERR_INVALID_ARG_TYPE]: The "options.lookup" property must be of type function. Received type string ('(...args) => {

In 4.49.0

If I should guess the culprit, I'd say this line: lookup is not a string, it's a function.

Edit:
confirming that replacing the above line by this._setValue(opts, 'lookup', options.lookup) solves the problem

blemoine added a commit to blemoine/dd-trace-js that referenced this issue Nov 18, 2024
The previous version was transforming the lookup
parameter to a string.

Closes DataDog#4894
@tlhunter
Copy link
Member

tlhunter commented Feb 4, 2025

I believe this was fixed in this release of the tracer: #5067

Note that the v4.x version of the tracer has reached End of Life since the bug was fixed. Can you upgrade to a recent v5.x version of the tracer and see if this fixes it for you?

tlhunter pushed a commit that referenced this issue Feb 11, 2025
The previous version was transforming the lookup
parameter to a string.

Closes #4894
tlhunter added a commit that referenced this issue Feb 12, 2025
The previous version was transforming the lookup parameter to a string.

Closes #4894

Co-authored-by: Benoit Lemoine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants