GithubHelp home page GithubHelp logo

Comments (12)

byeokim avatar byeokim commented on August 21, 2024 2

What is the result of the following code?

const {google} = require('googleapis');

const auth = new google.auth.OAuth2(CLIENT_ID, CLIENT_SECRET);

auth.setCredentials({
  access_token: USER_ACCESS_TOKEN,
  refresh_token: USER_REFRESH_TOKEN,
  scope: USER_SCOPE,
  token_type: USER_TOKEN_TYPE,
  expiry_date: USER_EXPIRY_DATE
});

const gmail = google.gmail({
  version: 'v1',
  auth,
});

gmail.users
  .watch({
    userId: EMAIL_ADDRESS_OF_USER,
    requestBody: {
      topicName: projects/PROJECT_NAME/subscriptions/SUBSCRIPTION_NAME,
    },
  })
  .then((result) => console.log(result))
  .catch((err) => console.log(err));

from gmailpush.

byeokim avatar byeokim commented on August 21, 2024 1

Ok do you have gmailpush_history.json file in your project directory and if so, is the content of the file something like this?

[{"emailAddress":"[email protected]","prevHistoryId":16404,"watchExpiration":1595828633883}]

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

It show nothing 200 status code. I tried stop too 204 status code and look like it didnt stop 🐶

from gmailpush.

byeokim avatar byeokim commented on August 21, 2024

Was there anything in data property like data: { historyId: '3611979', expiration: '1595827674000' }?

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024
{
  config: {
    url: 'https://www.googleapis.com/gmail/v1/users/akinasand%40gmail.com/watch?topicName=projects%2Fpubsub-283819%2Ftopics%2FMyTopc&labelIds=UNREAD',
    method: 'POST',
    userAgentDirectives: [ [Object] ],
    paramsSerializer: [Function],
    headers: {
      'x-goog-api-client': 'gdcl/4.4.0 gl-node/12.16.1 auth/6.0.5',
      'Accept-Encoding': 'gzip',
      'User-Agent': 'google-api-nodejs-client/4.4.0 (gzip)',
      Authorization: 'Bearer ya29.a0AfH6SMDsti4CXNWMtZWC9N_WnNykZBFFIvGaZuimZMeAwhHubaLB-hZVV8ksXsbTHz7MD2bRU6ERdjhxI3033v8ff789XjxdjvvxQ0N0juv4zcaG9TFai4iEseCj5TajCcX8o3P2e4UfITOzXsttuQsiEHwiX6HrbWRW1',
      Accept: 'application/json'
    },
    params: [Object: null prototype] {
      topicName: 'projects/pubsub-283819/topics/MyTopc',
      labelIds: [Array]
    },
    validateStatus: [Function],
    retry: true,
    responseType: 'json'
  },
  data: { historyId: '16404', expiration: '1595828633883' },
  headers: {
    'alt-svc': 'h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',      
    'cache-control': 'private',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-type': 'application/json; charset=UTF-8',
    date: 'Mon, 20 Jul 2020 05:43:53 GMT',
    server: 'ESF',
    'transfer-encoding': 'chunked',
    vary: 'Origin, X-Origin, Referer',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'SAMEORIGIN',
    'x-xss-protection': '0'
  },
  status: 200,
  statusText: 'OK',
  request: {
    responseURL: 'https://www.googleapis.com/gmail/v1/users/akinasand%40gmail.com/watch?topicName=projects%2Fpubsub-283819%2Ftopics%2FMyTopc&labelIds=UNREAD'
  }
}

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

Was there anything in data property like data: { historyId: '3611979', expiration: '1595827674000' }?

yes.

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

Ok do you have gmailpush_history.json file in your project directory and if so, is the content of the file something like this?

[{"emailAddress":"[email protected]","prevHistoryId":16404,"watchExpiration":1595828633883}]

Got it, let's me try, I can see that file. This must do on server

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

@byeokim Thank you, I did it :) the file gmailpush_history need to be delete.
If I run stop command will pubsub stop? I tried before but look like it not stop :s

from gmailpush.

byeokim avatar byeokim commented on August 21, 2024

Congrats!

Unfortunately I don't know why it won't stop sending notifications to Google Pub/Sub topic after you invoked stop().

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

I don't know it get this error on server. I tried to read from server and get this.
{"data":"[{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":1596434240536},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null}]"}

sometime it work perfect, but sometime it get this error. What can make this error?

from gmailpush.

byeokim avatar byeokim commented on August 21, 2024

Are you still having that issue?

from gmailpush.

IRediTOTO avatar IRediTOTO commented on August 21, 2024

I am not sure, i tried to delete file on server then look like it work ok. Lets me tracking that

from gmailpush.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.