Corredor server scripts issue

Hello all,

I’ve been using AWS for my Corteza deployment
recently, I need to move my servers to GCP (we use Kubernetes there )

I deployed corteza and corridor but on the corredor logs I got this warning

[1665642261739] WARN  (services.server-scripts): could not require() script: TypeError: Channel target must be a string
    at new ChannelImplementation (/automations/node_modules/@grpc/grpc-js/src/channel.ts:219:13)
    at new Client (/automations/node_modules/@grpc/grpc-js/src/client.ts:157:30)
    at new ServiceClientImpl (/automations/node_modules/@grpc/grpc-js/src/make-client.ts:129:3)
    at Object.<anonymous> (/automations/utils/grpc_request.js:24:31)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module.m._compile (/corredor/node_modules/ts-node/src/index.ts:858:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .js] (/corredor/node_modules/ts-node/src/index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    src: "/automations/server-scripts/user/update_users_grpc.js"

although it’s a warning, some of the server scripts run as expected and others show Uninitialized script error!!
this is from the logs too

(node:1) UnhandledPromiseRejectionWarning: Error: startBatch failed
    at handleError (/corredor/node_modules/grpc/src/server.js:69:8)
    at sendUnaryData (/corredor/node_modules/grpc/src/server.js:599:9)
    at Object.HandleException (/corredor/src/grpc-server/errors.ts:69:3)
    at /corredor/src/grpc-handlers/server-scripts.ts:159:13
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 13)

I don’t know what’s happening and the logs not helping me here
any help would be appreciated

The error is being thrown by grpc

It looks like you have a custom script that interacts with grpc

What’s the content of that?

hey @shmuel

yes, I use an external gRPC server (3rd party)
so I have server-script that calls the gRPC server

is it a configuration issue or a dependency issue?

@munawir ,

I have no clue without seing your setup.

If the only thing you did was change hosting from AWS to GCP, my guess would be it’s a configuration issue.

If you made other changes alongside that migration, it could be those changes are responsible instead.


import { loadPackageDefinition, credentials } from "@grpc/grpc-js";
import { loadSync } from "@grpc/proto-loader";
const PROTO_PATH = "../automations/protobuf/automations.proto";
const GRPC_SERVER = process.env.GRPC_SERVER

const options = {
  longs: String,
  oneofs: true,
  keepCase: true,
  enums: String,
  defaults: true,
};

var packageDefinition = loadSync(PROTO_PATH, options);
const protoDescriptor = loadPackageDefinition(packageDefinition)
// console.log(protoDescriptor);


const General = protoDescriptor.Automations.General

export const general_client = new General(GRPC_SERVER,  credentials.createInsecure());

@shmuel
how can I check which environment variables are related to this?

cause this warning happening with I deploy corredor (not while executing a script)

This looks like a possible culprit. Add a console.log here and check if GRPC_SERVER is null

@shmuel this is the ip of 3rd party server
it’s not null

even though it’s null or unreachable
the warning Channel target must be a string shows up when the Corredor server starts!
the above code got executed from server-script triggered by manual

I’m all out of ideas given the information provided.

:man_shrugging:

1 Like

Hi all, it fixed

it was miss configurations :slight_smile:

1 Like