nodejs-mobile / nodejs-mobile-react-native

Node.js for Mobile Apps React Native plugin
https://nodejs-mobile.github.io
MIT License
174 stars 42 forks source link

After the request takes too long, it is canceled and I get a 504 error #29

Closed JBlazej closed 2 years ago

JBlazej commented 2 years ago

Hi, I tried your library to implement a Nodejs Server (Android only) for fetching data from API. Everything seems fine, but when the request takes about +30s, I get back the response Request failed with status code 504.

I tried to start the server with arguments like so and set the default timeout to 2 minutes but it did not help. nodejs.startWithArgs(`${NODEJS_CHANNEL} --http-server-default-timeout=120000`)

Are there any limitations for calling requests on Thread? We have devices with slow internet connections and we want to be able to let them call API with a bigger timeout.

Thanks for the help 🙏 Love your library 🖤

app dependencies

"react-native": "0.68.2",
"nodejs-mobile-react-native": "0.8.2",
"react": "17.0.2",

nodejs-project dependencies "axios": "0.27.2", "dayjs": "1.11.5", "lodash": "4.17.21", "ramda": "0.28.0"

Request example

const url = apiURL

const headers = {
    Authorization: jwtToken,
    'Content-Type': 'application/json',
  }
 const query = `
    mutation test () {
      test() {
        data
      }
    }
  `
const body = {
    query,
    variables: {
      data: {
        test,
      },
    },
  }

  return axios.post(url, body, {headers})

react-native info

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.90 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: Not Found
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found