Back

"node-appwrite" can not be tested in React typescript environment

  • 1
  • React Native
  • Web
Lauriane
27 Aug, 2024, 05:16

I did: npx create-react-app my-app --template typescript npm i node-appwrite

I wrote this simple test in src/appwrite.test.ts

TypeScript
import { ID } from "node-appwrite";

describe("Test", () => {
  test("create new entry", async () => {
    ID.unique()
  });
});

And I get the error:

TypeScript
    Cannot find module 'node-fetch-native-with-agent/agent' from 'node_modules/node-appwrite/dist/client.js'

    Require stack:
      node_modules/node-appwrite/dist/client.js
      node_modules/node-appwrite/dist/index.js
      src/appwrite.test.ts

So I did: npm i node-fetch-native-with-agent npm i

But the error is still there.

TL;DR
Issue with testing "node-appwrite" in React TypeScript environment - Developer mentioned it's not their issue - Using web SDK as an alternative - Some things may not behave as expected - React Native SDK is in beta stage since April 2024 - Question about when React Native SDK will be in full use
D5
27 Aug, 2024, 10:43

There is a react native SDK. WHy do you want to use the node one in react?

PAVAN SUTHAR
27 Aug, 2024, 11:55

But React native SDK is in beta stage since April 2024. When it would be in full prod-usage? any idea?

D5
27 Aug, 2024, 11:56

It should be fine if using it in production. Just spect that some things will not behave as expected

D5
27 Aug, 2024, 11:56

But most things should be fine

D5
27 Aug, 2024, 11:56

If you still prefer using another SDK, you can choose using the web SDK

PAVAN SUTHAR
27 Aug, 2024, 11:58

Yes

D5
27 Aug, 2024, 11:59

So does that solve your issue?

PAVAN SUTHAR
27 Aug, 2024, 12:00

Its @Lauriane issue, not mine.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more