Moesif / auth0-logs-to-moesif

Other
6 stars 3 forks source link

Install Button Not Working #12

Closed BillChirico closed 4 weeks ago

BillChirico commented 1 year ago

The install button routes to https://sandbox.it.auth0.com/api/run/auth0-extensions/extensions-badge?webtask_no_cache=1 and that is giving me an error.

xinghengwang commented 1 year ago

ok. we are looking.

BillChirico commented 1 year ago

ok. we are looking.

Thank, you please keep me posted.

xinghengwang commented 1 year ago

Hi, looks like Auth0 is moving towards their Stream log model (which is only available on their paid plans) and deprecated the exporting logs feature via webtasks.

https://auth0.com/docs/customize/log-streams/custom-log-streams

AND, the stream is only available on their certain price tiers.

Screenshot 2023-10-12 at 10 12 20 AM

Looks the logic for custom log stream is pretty easy. If you are already paying customer of Auth0 and have access to their Custom Log Stream, you can easily convert those into Moesif event format.

We can file a ticket to handle the Auth0 new custom log streams webhooks. We'll let you know.

However, if you can't wait, looks code looks pretty simple. You jsut have to convert from their format to our format:

https://www.moesif.com/docs/api?json#log-an-api-call

superagent.post(`https://api.moesif.net/v1/events/batch`).set('X-Moesif-Application-Id', 'YOUR MOESIF APPLICATION ID').send([
eventsInMoesifFormat
])

And events in moesif format are like speced here https://www.moesif.com/docs/api?json#log-an-api-call), an example below.

  {
    "request": {
      "time": "2023-10-06T04:45:42.914",
      "uri": "https://api.acmeinc.com/items/12345/reviews/",
      "verb": "POST",
      "api_version": "1.1.0",
      "ip_address": "61.48.220.123",
      "headers": {
        "Host": "api.acmeinc.com",
        "Accept": "*/*",
        "Connection": "Keep-Alive",
        "Content-Type": "application/json",
        "Content-Length": "126",
        "Accept-Encoding": "gzip"
      },
      "body": {
        "items": [
          {
            "direction_type": 1,
            "item_id": "hello",
            "liked": false
          },
          {
            "direction_type": 2,
            "item_id": "world",
            "liked": true
          }
        ]
      },
      "transfer_encoding": ""
    },
    "response": {
      "time": "2023-10-06T04:45:42.914",
      "status": 500,
      "headers": {
        "Vary": "Accept-Encoding",
        "Pragma": "no-cache",
        "Expires": "-1",
        "Content-Type": "application/json; charset=utf-8",
        "Cache-Control": "no-cache"
      },
      "body": {
        "Error": "InvalidArgumentException",
        "Message": "Missing field location"
      },
      "transfer_encoding": ""
    },
    "user_id": "12345",
    "company_id": "67890",
    "session_token": "XXXXXXXXX",
    "metadata": {
        "some_string": "I am a string",
        "some_int": 77,
        "some_object": {
            "some_sub_field": "some_value"
        }
    }
  }
BillChirico commented 1 year ago

Hi, looks like Auth0 is moving towards their Stream log model (which is only available on their paid plans) and deprecated the exporting logs feature via webtasks.

https://auth0.com/docs/customize/log-streams/custom-log-streams

AND, the stream is only available on their certain price tiers.

Screenshot 2023-10-12 at 10 12 20 AM

Looks the logic for custom log stream is pretty easy. If you are already paying customer of Auth0 and have access to their Custom Log Stream, you can easily convert those into Moesif event format.

We can file a ticket to handle the Auth0 new custom log streams webhooks. We'll let you know.

However, if you can't wait, looks code looks pretty simple. You jsut have to convert from their format to our format:

https://www.moesif.com/docs/api?json#log-an-api-call


superagent.post(`https://api.moesif.net/v1/events/batch`).set('X-Moesif-Application-Id', 'YOUR MOESIF APPLICATION ID').send([

eventsInMoesifFormat

])

And events in moesif format are like speced here https://www.moesif.com/docs/api?json#log-an-api-call), an example below.


  {

    "request": {

      "time": "2023-10-06T04:45:42.914",

      "uri": "https://api.acmeinc.com/items/12345/reviews/",

      "verb": "POST",

      "api_version": "1.1.0",

      "ip_address": "61.48.220.123",

      "headers": {

        "Host": "api.acmeinc.com",

        "Accept": "*/*",

        "Connection": "Keep-Alive",

        "Content-Type": "application/json",

        "Content-Length": "126",

        "Accept-Encoding": "gzip"

      },

      "body": {

        "items": [

          {

            "direction_type": 1,

            "item_id": "hello",

            "liked": false

          },

          {

            "direction_type": 2,

            "item_id": "world",

            "liked": true

          }

        ]

      },

      "transfer_encoding": ""

    },

    "response": {

      "time": "2023-10-06T04:45:42.914",

      "status": 500,

      "headers": {

        "Vary": "Accept-Encoding",

        "Pragma": "no-cache",

        "Expires": "-1",

        "Content-Type": "application/json; charset=utf-8",

        "Cache-Control": "no-cache"

      },

      "body": {

        "Error": "InvalidArgumentException",

        "Message": "Missing field location"

      },

      "transfer_encoding": ""

    },

    "user_id": "12345",

    "company_id": "67890",

    "session_token": "XXXXXXXXX",

    "metadata": {

        "some_string": "I am a string",

        "some_int": 77,

        "some_object": {

            "some_sub_field": "some_value"

        }

    }

  }

Hello,

Thanks for looking into this. I'll try manual and wait for the automation as well.

BillChirico commented 1 year ago

Are Auth0 logs for importing users and companies? Or is that all done on my end?

BillChirico commented 1 year ago

@xinghengwang Can we hop on a call or email thread regarding this issue?

xinghengwang commented 1 month ago

the issue is that Auth0 depcreated the old log extension. They moved to the log streaming. It just required a minor data transform webhook. The sample code and insrucitnos are updated now.