Page 1 of 1

Unable to perform HTTP request while testing on physical device

Posted: 2023年 Nov 9日 17:46
by Fadikk367

Hi everyone,
We are developing a simple Smart Mini App that communicates with our custom backend. We have a problem with testing the app on real device (Live Preview feature, scanning QR code from the IDE) because we are unable to perform a single outgoing HTTP request...

ty.request({
      url: '<CUSTOM_BACKEND_URL>',
      header: '<AUTH INFO>',
      complete: () => {
        console.log('complete')
      },
      success: (data) => {
        console.log('success', data) // NEVER CALLED
      },
      failure: (error) => {
        console.log('failure', error)  // NEVER CALLED
      },
    })

While complete callback is called both success and failure are never invoked so we have no idea what is going on. In the IDE it works as expected. Does anyone came across similar issue maybe?


Re: Unable to perform HTTP request while testing on physical device

Posted: 2023年 Nov 21日 17:43
by 智能小程序管理员
  1. Please check this doc https://developer.tuya.com/en/miniapp/guide/audit.
  2. Check the complete func args
  3. You can use Remote Debugger to view the log .https://developer.tuya.com/en/miniapp/d ... mote-debug

Re: Unable to perform HTTP request while testing on physical device

Posted: 2023年 Nov 29日 20:43
by Fadikk367
涂鸦张凯 2023年 Nov 21日 17:43
  1. Please check this doc https://developer.tuya.com/en/miniapp/guide/audit.
  2. Check the complete func args
  3. You can use Remote Debugger to view the log .https://developer.tuya.com/en/miniapp/d ... mote-debug

Thank you very much! It turned out that we were missing explicitly listing our server domain name on the allowlist -> https://developer.tuya.com/en/miniapp/g ... quirements. The only strange thing was that we weren't getting any error saying that this domain is not listed. Thanks one again.