stream-js icon indicating copy to clipboard operation
stream-js copied to clipboard

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

Open thecannabisapp opened this issue 2 years ago • 5 comments

Hi, I've upgraded getstream from [email protected] to [email protected], 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"
  ]
}

thecannabisapp avatar Jun 03 '23 10:06 thecannabisapp

I too am having the same errors

rlee1990 avatar Jul 10 '23 22:07 rlee1990

@JimmyPettersson85 can someone take a look into this?

rlee1990 avatar Jul 11 '23 04:07 rlee1990

I did a yarn list axios to show what is in my project dependency tree when using 8.1.5 vs 7.4.1.

❯ yarn list axios
yarn list v1.22.19
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ [email protected]
├─ [email protected]
│  └─ [email protected]
├─ [email protected]
│  └─ [email protected]
└─ [email protected]
   └─ [email protected]
✨  Done in 0.71s.
❯ yarn list axios
yarn list v1.22.19
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ [email protected]
├─ [email protected]
│  └─ [email protected]
└─ [email protected]
   └─ [email protected]
✨  Done in 0.68s.

thecannabisapp avatar Jul 19 '23 08:07 thecannabisapp

I had to downgrade to make getstream work (clean-slate installation).

merapi avatar Nov 09 '23 13:11 merapi

Hello. I'm looking into the issue. If you could provide me some more information about how you're using the SDK I would appreciate, react native?

xernobyl avatar Nov 09 '23 14:11 xernobyl