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

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

Open
thecannabisapp opened this issue Jun 3, 2023 · 5 comments
Open

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

thecannabisapp opened this issue Jun 3, 2023 · 5 comments
Assignees

Comments

@thecannabisapp
Copy link

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"
  ]
}
@rlee1990
Copy link

I too am having the same errors

@rlee1990
Copy link

@JimmyPettersson85 can someone take a look into this?

@thecannabisapp
Copy link
Author

thecannabisapp commented Jul 19, 2023

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.
├─ axios@0.21.4
├─ getstream@8.1.5
│  └─ axios@1.4.0
├─ react-activity-feed@1.4.0
│  └─ axios@0.22.0
└─ stream-chat@8.10.1
   └─ axios@0.22.0
✨  Done in 0.71s.
❯ yarn list axios
yarn list v1.22.19
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ axios@0.21.4
├─ getstream@7.4.1
│  └─ axios@0.22.0
└─ stream-chat@8.10.1
   └─ axios@0.22.0
✨  Done in 0.68s.

@merapi
Copy link

merapi commented Nov 9, 2023

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

@xernobyl
Copy link
Contributor

xernobyl commented Nov 9, 2023

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 xernobyl self-assigned this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants