Connector Development Kit

Tips and FAQs

This page contains troubleshooting tips and FAQs for CDK.

Logging requests and responses

You can use console.log statement in the handler to log requests and responses:

export const getTopRatedMoviesHandler = OperationHandlerSetup.configureHandler<
  TmdbAuth,
  GetTopRatedMoviesInput,
  GetTopRatedMoviesOutput
>((handler) =>
  handler.withGlobalConfiguration(globalConfigHttp).usingHttp((http) =>
    http
      .get("/3/movie/top_rated")
      .handleRequest((_ctx, _input, request) => \{
        console.log(request.withoutBody());
        return request.withoutBody();
      \})
      .handleResponse((_ctx, _input, response) => \{
        console.log(response.parseWithBodyAsJson());
        return response.parseWithBodyAsJson();
      \})
  )
);

You can also log responses in the handler.test files:

OperationHandlerTestSetup.configureHandlerTest(
  getTopRatedMoviesHandler,
  (handlerTest) =>
    handlerTest
      .usingHandlerContext("test")
      .nothingBeforeAll()
      .testCase("should return 20 movies", (testCase) =>
        testCase
          .givenNothing()
          .when(() => ({}))
          .then(({ output }) => \{
            const outputValue =
              OperationHandlerResult.getSuccessfulValueOrFail(output);
            console.log(outputValue);
            expect(outputValue.results.length).toEqual(20);
          \})
          .finallyDoNothing()
      )
      .nothingAfterAll()
);

Request Timeouts

Your tests may time out if the 3rd party service API is taking longer than 5 seconds to respond.

This is because the testing library for CDK: jest has a default timeout of 5 seconds for each test.

To increase timeout for a particular operation, simply add jest.setTimeout(<timeout value in milliseconds>) to your handler.test.ts file. e.g.

jest.setTimeout(30000); //30000 milliseconds

You can increase timeout for all of your tests by setting testTimeout property in jest.config.json file. e.g. "testTimeout": 30000 where 30000 is the timeout in milliseconds.

Deployment rejected: CDK version below the minimum

If tray-cdk deployment get reports Connector Build Failed followed by an error like this:

Error: The connector's package.json targets a CDK version this platform no longer supports (minimum 7.0.0).
- @trayio/cdk-dsl "^6.0.0" does not admit any version at or above 7.0.0, which is the oldest this platform still builds against; declare @trayio/cdk-dsl as "^7.0.0" or newer.
Upgrade the project with the current @trayio/cdk-cli (npm install -g @trayio/cdk-cli), or edit package.json by hand, then deploy again.

the connector's package.json declares @trayio/cdk-dsl or @trayio/cdk-runtime with a version range that cannot resolve to v7.0.0 or higher, the minimum the platform builds against. Nothing was built or deployed. Update both packages to the current release, "^8.0.0" (or "*"), delete node_modules and package-lock.json, run npm i, make sure npm run build and npm test pass on Node 26, then deploy again. See Minimum CDK version for deployments and the Migration Guide.

Deployment errors

You may encounter the below error while deploying the connector:

Error (500): \{"message":"ENOTEMPTY: directory not empty, rmdir './tmp/connectors/cloudscale-Dubber/node_modules/@types/node'","\_tag":"InternalError"\}

To solve this, simpley delete node_modules folder and perform a reinstall using npm i

Was this page helpful?