interledger / rafiki

An open-source, comprehensive Interledger service for wallet providers, enabling them to provide Interledger functionality to their users.
https://rafiki.dev/
Apache License 2.0
226 stars 77 forks source link

[BUG] Internal Server Error on Interact Redirect URL #2745

Closed BlairCurrey closed 4 weeks ago

BlairCurrey commented 1 month ago

Description

When navigating to the interact url there is an Request failed with status code 500 and I see this error in auth:

  "err": {
    "type": "RangeError",
    "message": "Input buffers must have the same byte length",
    "stack": "RangeError: Input buffers must have the same byte length\n    at getGrantDetails (/home/rafiki/packages/auth/src/interaction/routes.ts:122:13)\n    at details (/home/rafiki/packages/auth/src/interaction/routes.ts:105:35)\n    at dispatch (/home/rafiki/node_modules/.pnpm/koa-compose@4.1.0/node_modules/koa-compose/index.js:42:32)\n    at /home/rafiki/node_modules/.pnpm/@interledger+openapi@2.0.1/node_modules/@interledger/openapi/dist/middleware.js:27:15\n    at dispatch (/home/rafiki/node_modules/.pnpm/koa-compose@4.1.0/node_modules/koa-compose/index.js:42:32)\n    at /home/rafiki/node_modules/.pnpm/@koa+router@12.0.0/node_modules/@koa/router/lib/router.js:425:16\n    at next (/home/rafiki/node_modules/.pnpm/koa-compose@4.1.0/node_modules/koa-compose/index.js:42:32)\n    at gnapServerErrorMiddleware (/home/rafiki/packages/auth/src/shared/gnapErrors.ts:38:11)\n    at dispatch (/home/rafiki/node_modules/.pnpm/koa-compose@4.1.0/node_modules/koa-compose/index.js:42:32)\n    at /home/rafiki/node_modules/.pnpm/@koa+router@12.0.0/node_modules/@koa/router/lib/router.js:425:16",
    "code": "ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH"
  },

It does not happen in the integration tests.

Looks like the root cause are some env value updates - probably just need to adjust the x-idp-secret header in the mock ase like this one was in the tests: https://github.com/interledger/rafiki/commit/99e43d7901de35f9eb07825502f9d6e1080ef2c9#diff-7d108c79df02eb44254b549745bd165705873ac17551f3f4b66c1e409bb82b04R60

To Reproduce

  1. Run bruno "Open Payments" requests through Grant Request Outgoing Payment
  2. Visit the interact.redirect url from the Grant Request Outgoing Payment response.
  3. See Request failed with status code 500 in browser and above error in cloud-nine-auth-1 container

Expected behavior

Url request should succeeed and be able to complete interaction.