Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration does not appear to be working (403 status code from LogDrain endpoint on setup) #1

Open
dannyrb opened this issue Oct 28, 2022 · 3 comments

Comments

@dannyrb
Copy link

dannyrb commented Oct 28, 2022

Response upon submission:

{"statusCode":500,"error":"Internal Server Error","message":"https://api.vercel.com/v1/integrations/log-drains responded with 403"}
@dannyrb
Copy link
Author

dannyrb commented Oct 30, 2022

Thanks for this repository! It was helpful to see your process. I ended up creating a small next.js app, also hosted on Vercel, that functionally does something similar. It has endpoints for:

  • auth (initial integration setup)
  • create
  • list
  • delete

With page routes for:

  • setup
    • Button that... POST: code, next, teamId, configurationId to /api/auth
    • Displays the generated access_token
    • Instructs you to add it as an ENV Var for the self-hosted app
      • Doing this means you should enable SSO and/or Password auth for site
  • create
    • Can be used to create new Log Drains, but Env Var for access_token must be set
  • list
    • Lists all log drains created by integration; delete button next to each

It's crazy to me that Vercel doesn't surface LogDrain configuration per project/team in it's own UI. If anyone would find the source code for something like this useful, let me know? Happy to share/assist.

@valeriangalliat
Copy link
Owner

Hey @dannyrb!

I just successfully managed to install the custom log drain integration (https://vercel.com/integrations/custom-log-drain) on a new project of mine. I thought maybe Vercel had changed something in their API in the meantime, but I didn't get the 403 myself! Were you using the integration I provided or did you try to self-host the code from this repository?


It's crazy to me that Vercel doesn't surface LogDrain configuration per project/team in it's own UI.

I know! I'm shocked that this still isn't a thing. Maybe they really want to encourage paying for third-party logging integrations instead of configuring log drains to our own infrastructure 🤔

The Next.js app you built sounds awesome, it's definitely a great improvement to have an UI on top of the log drains API, and have the option to create/list/delete log drains without having to delete and re-install the integration! If you share the repository I'm pretty sure it's gonna be useful to a bunch of people out there, myself included!

I like your approach to the access_token. While it requires to self-host the app in order to set the env var, it's very convenieint that it doesn't require a database for that. 😄

I'm thinking an alternative way that could be used by anyone without self-hosting the app would be to generate a unique URL after installing the integration, that you can bookmark - that URL would include an encrypted version of the access token, so that the app can decrypt it back when it needs to list existing drains and create new ones. A complementary option would be to store that encrypted token in localStorage so that if the user comes back without their custom URL but with the same browser, we can still retrieve the token... I might add that to this repo if I find the time at some point

@valeriangalliat
Copy link
Owner

Oh about the original 403 issue, I encountered the same problem when installing it on our team workspace at work - the original implementation didn't support teams, only individual workspaces (the API requires to specify ?teamId=... in every requests otherwise gets denied, as you probably figured out for your own implementation 😄 )

I added support for that in the latest version of this project, as well as a small UI to view/create/delete the log drains inspired by the previous conversation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants