analytics.js-integrations icon indicating copy to clipboard operation
analytics.js-integrations copied to clipboard

@segmentio/send-json not being passed a timeout argument

Open texonidas opened this issue 4 years ago • 3 comments

While running segment locally in debug mode, I've run into an issue in lib/index.js on line 394. The send function being called (@segment/send-json) expects 5 arguments, (url, msg, headers, timeout, fn), however it is only being passed (url, msg, header, fn), and so I am getting constant "i is not a function" errors in my console.

texonidas avatar Feb 24 '21 00:02 texonidas

I started seeing the same errors today as well 😅

Issue is right here -

https://github.com/segmentio/analytics.js-integrations/blob/a441a1f29ac8783557d79b872f7e99d6e517b543/integrations/segmentio/lib/index.js#L394-L400

As texonidas mentioned, we are missing a timeout as the fourth argument.

iwakoscott avatar Feb 24 '21 01:02 iwakoscott

It looks like in this recent commit https://github.com/segmentio/analytics.js-integrations/commit/cf751050547b0078836c01946c2c2d69f1e4e322#diff-ec90774f0561687711e2f7e544859dfcb2d4900f482bc5eab32fc644159503e1, @segment/send-json was upgraded from v3 to v4.

The json() in v3 expects 4 arguments. The same function in v4 now expects 5 arguments.

shaunma avatar Feb 24 '21 02:02 shaunma

https://github.com/segmentio/analytics.js-integrations/pull/563

I've added pull request to fix this, I just used a 1s for send because I'm really not sure what was an appropriate value to use.

texonidas avatar Feb 24 '21 03:02 texonidas