3

I'm having some trouble connecting to the cube.js backend on AWS serverless and executing the /cubejs-api/v1/load request in the frontend dashboard. I keep getting {"error":"Continue wait"} instead of a result returned. I am following the react-dashboard guide for authentication but deployed using the backend cube.js serverless AWS template. This is what my main cube.js file looks like.:

const AWSHandlers = require('@cubejs-backend/serverless-aws');
const PostgresDriver = require('@cubejs-backend/postgres-driver');
const fs = require("fs");
const jwt = require("jsonwebtoken");
const jwkToPem = require("jwk-to-pem");
const jwks = JSON.parse(fs.readFileSync("jwks.json"));
const _ = require("lodash");

module.exports = new AWSHandlers({
  checkAuth: async (req, auth) => {
    const decoded = jwt.decode(auth, { complete: true });
    const jwk = _.find(jwks.keys, x => x.kid === decoded.header.kid);
    const pem = jwkToPem(jwk);
    req.authInfo = jwt.verify(auth, pem);
  },
  externalDbType: 'postgres',
  externalDriverFactory: () => new PostgresDriver({
    host: process.env.CUBEJS_EXT_DB_HOST,
    database: process.env.CUBEJS_EXT_DB_NAME,
    port: process.env.CUBEJS_EXT_DB_PORT,
    user: process.env.CUBEJS_EXT_DB_USER,
    password: process.env.CUBEJS_EXT_DB_PASS,
  })
});

I didn't have the redis URL set correctly initially and fixed the connection to redis after adding redis:// extension before the url to the serverless.yml file to fix that so I know it's not redis connection issue. I'm assuming there's some other problem.

The cubejs process function has no logs at all. I have setup a NAT gateway and subnets according to the guide on the deployment site so that i have 1 subnet for each zone just for the lambda and they have been added to the new NAT gateway that was created and to the 2 functions so they have internet access.

What could be the issue? Did I configure something wrong or do I need to make changes to something?

George
  • 301
  • 3
  • 18

1 Answers1

6

@cubejs-backend/serverless uses internet connection to access messaging API as well as Redis inside VPC for managing queue and cache.

Such continuous Continue wait messages usually mean that there's a problem with internet connection or with Redis connection. If it's Redis you'll usually see timeouts after 5 minutes or so in both cubejs and cubejsProcess functions. If it's internet connection you will never see any logs of query processing in cubejsProcess function.

Pavel Tiunov
  • 1,163
  • 6
  • 8
  • 4
    Thanks Pavel! It was indeed an issue of internet connectivity of the lambda functions. For any future users, you must make sure that the NAT gateway is attached to a PUBLIC subnet (with a route to the internet gateway), and then your private subnets should be pointing to the NAT gateway. Also make sure your lambda functions have the custom subnets selected and NOT the default subnet which is direct to internet gateway. – George Apr 01 '20 at 20:05
  • I have the same issue (always get "Continue wait" and process has no logs). However, I can publish messages to the SNS from the `cubejs` lambda using the AWS SDK. Does cube depend on some different mechanism to publish messages? – Bananin Apr 13 '21 at 00:37