pi-apps / pi-platform-docs

1.73k stars 367 forks source link

Uncaught (in promise) Error: Messaging promise with id 0 timed out after 120000ms. pi-sdk.js:1:3167 #320

Closed fachryluid closed 1 year ago

fachryluid commented 1 year ago

I got this error while authenticating user on testnet

This is my typescript code

import axios from 'axios';

declare global {
  interface Window {
      Pi:any;
  }
}

interface PaymentDTO {
  amount: number,
  user_uid: string,
  created_at: string,
  identifier: string,
  metadata: Object,
  memo: string,
  status: {
    developer_approved: boolean,
    transaction_verified: boolean,
    developer_completed: boolean,
    cancelled: boolean,
    user_cancelled: boolean,
  },
  to_address: string,
  transaction: null | {
    txid: string,
    verified: boolean,
    _link: string,
  },
};

type AuthResult = {
  accessToken: string,
  user: {
    uid: string,
    username: string
  }
};

const signIn = async () => {
  const scopes = ['username', 'payments'];
  const authResult: AuthResult = await window.Pi.authenticate(scopes, onIncompletePaymentFound);
  console.log(authResult)
}

const onIncompletePaymentFound = (payment: PaymentDTO) => {
  console.log("onIncompletePaymentFound", payment);
  // return axiosClient.post('/payments/incomplete', {payment});
}

export default { signIn }

console

image