Skip to content

Unable to signin with oauth tokens when using this library. #58

Description

@rlam3

Package Version: @tastytrade/api@6.0.0

Node Version: v22.12.0

Module System: ES Modules ("type": "module")

Problem

When importing TastytradeClient from @tastytrade/api v6.0.0, the application crashes with the following error:

SyntaxError: The requested module '@dxfeed/dxlink-api' does not provide an export named 'DXLinkFeed'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)

Root Cause

The issue is in lib/quote-streamer.ts line 1:

// CURRENT (BROKEN):
import { DXLinkWebSocketClient, DXLinkFeed, FeedContract, FeedDataFormat, type DXLinkFeedEventListener } from '@dxfeed/dxlink-api'

In @dxfeed/dxlink-api version 0.5.x, the DXLinkFeed export was moved from @dxfeed/dxlink-api to a separate package @dxfeed/dxlink-feed.

However, quote-streamer.ts still tries to import it from the old location, causing the error.

Impact

This error occurs even when not using the QuoteStreamer because:

  1. TastytradeClient constructor instantiates QuoteStreamer (line 88 of tastytrade-api.ts)
  2. This loads quote-streamer.ts
  3. Node.js evaluates all imports immediately
  4. The broken import fails before any code runs

This makes the entire @tastytrade/api@6.0.0 package unusable with current DXLink dependencies.

Reproduction Steps

npm install @tastytrade/api@6.0.0 
import TastytradeClient from "@tastytrade/api";

const client = new TastytradeClient({
  ...TastytradeClient.ProdConfig,
  clientSecret: 'your-client-secret',
  refreshToken: 'your-refresh-token',
  oauthScopes: ['read']
});

// 💥 Crashes before this line even executes

Proposed Fix

Split the import statement in lib/quote-streamer.ts:

// FIX:
import { DXLinkWebSocketClient, FeedContract, FeedDataFormat, type DXLinkFeedEventListener } from '@dxfeed/dxlink-api'
import { DXLinkFeed } from '@dxfeed/dxlink-feed'

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions