backpack1098B
Convex Community2y ago
14 replies
backpack1098

loading protos

Hi team. im trying to load some protos into the convex backend but couldnt figure out how
// client.js
"use node"

import grpc from "@grpc/grpc-js"
import { loadSync } from "@grpc/proto-loader"

export class Client {
  constructor(address) {
    var PROTO_PATH = "./../../src/protos/client.proto"
    const packageDefinition = loadSync(PROTO_PATH, {
      keepCase: true,
      longs: String,
      enums: String,
      defaults: true,
      oneofs: true,
    })

my directory looks sth like
.
├── convex
│   ├── client
│   │   ├── client.js
├── src
│   ├── protos
│   │   └── client.proto

tried a few variations but keep running into
Uncaught Error: ENOENT: no such file or directory, open '../../src/protos/client.proto'

i also tried moving the protos/client.proto into the convex dir/ but got an error like
✘ [ERROR] No loader is configured for ".proto" files: convex/client/protos/client.proto

i'd apprecate any tips on how to debug the error. thanks!
Was this page helpful?