Skip to content

Uncaught TypeError: axios.default.create is not a function #560

@thecannabisapp

Description

@thecannabisapp

Hi, I've upgraded getstream from getstream@7.4.1 to getstream@8.1.5, but now I'm getting all sorts of errors when I try to connect to the client.

Uncaught TypeError: axios.default.create is not a function
    at new StreamClient (client.js:220:1)
    at connect (connect.js:46:1)

Here's my React app code for setting up the client.

import { StreamClient, connect } from "getstream";

const useCreateFeedClient = () => {
  const { STREAM_KEY, STREAM_APP_ID } = useConfig();
  const { data: streamToken } = useStreamTokenQuery();
  const [feed, setFeed] = useState<StreamClient>(undefined!);

  useEffect(() => {
    if (!streamToken) return;
    setFeed(connect(STREAM_KEY, streamToken.feed, STREAM_APP_ID));
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [streamToken]);

  return feed;
};

What am I doing wrong here?

I noticed in 7.4.1 axios is 0.22, but on 8.1.5 axios is 1.4. I'm a bit puzzled. Here's my tsconfig.json just in case.

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
  },
  "include": [
    "src",
    "src/service-worker.ts"
  ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions