calcom / cal.com

Scheduling infrastructure for absolutely everyone.
https://cal.com
Other
32.64k stars 8.09k forks source link

Zoho Calendar app get access_token failed #11708

Open KossaKo opened 1 year ago

KossaKo commented 1 year ago

Issue Summary

While trying to connect Zoho Calendar with the Zoho Calendar app on a selfhosted instance get access_token fails

Steps to Reproduce

  1. Configure Zoho API Access and Calcom Zoho Calendar app according to its Readme.md in the admin area
  2. Adding new calendar from installed apps view, selecting Zoho Calendar
  3. Redirects to Zoho Auth Flow, after granting the requested permissions being redirect back to Calcom instance

Actual Results

The Zoho calendar app does not show and cannot be selected e.g. for creating events in it.

Expected Results

The Zoho calendar app shows after configuration and the calendars can be used to check availability and book appointments

Technical details

09:48:30.338 ERROR [[zohocalendar/api/callback] get access_token failed 
{
 error: 'invalid_code'
}
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
     at new NodeError (node:internal/errors:405:5)
     at ServerResponse.setHeader (node:_http_outgoing:648:11)
     at _res.setHeader (/calcom/node_modules/next/dist/server/base-server.js:306:24)
     at sendJson (/calcom/node_modules/next/dist/server/api-utils/node.js:226:9)
     at apiRes.json (/calcom/node_modules/next/dist/server/api-utils/node.js:445:31)
     at /calcom/apps/web/.next/server/chunks/1683.js:61:29
     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
     at async /calcom/apps/web/.next/server/chunks/1011.js:250:13
     at async handler (/calcom/apps/web/.next/server/pages/api/integrations/[...args].js:896:13) {
   code: 'ERR_HTTP_HEADERS_SENT'
 }

The "cannot set headers after..." message is repeated exactly the same 4 times for every attempt in setting up the app. I followed a hunch that it might have to do with different Zoho URLs for different regions, as accounts.zoho.com is hardcoded in the callback API from the app, where the error seems to stem from, but setting it manually to accounts.zoho.eu instead did not resolve it.

github-actions[bot] commented 1 year ago

Thank you for opening your first issue, one of our team members will review it as soon as it possible. ❤️🎉