question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use google/protobuf/any.proto

See original GitHub issue

// I am using Any type in one of my proto file 

import "google/protobuf/any.proto";

But when i am running the generator it is generating the import like :

import { Any } from "./google\\protobuf\\any";

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
timostammcommented, Nov 27, 2020

But when i am running the generator it is generating the import like :

import { Any } from "./google\\protobuf\\any";

Fixed in v1.0.11

1reaction
SyedAsimAliSEcommented, Nov 26, 2020

it seems it need path normalization , i already tried to replace paths, but it says module not found .

import { Any } from "./google/protobuf/any";

image

Managed to compile it with :

import { Any } from "google-protobuf/google/protobuf/any_pb.js";

but don’t know if it works or not because i am unable to go past this :

i am trying to migrate from grpc-js to protobuf-ts in my NestJS project, using nodejs 14.15.1 with tsconfigs set to ES2020.

after reading the documentation installed Twirp transport

and added the following call to the server.

                const transport = new TwirpFetchTransport({
			baseUrl: "0.0.0.0:50052"
		});

		const client = new ProcessTypeWritesServiceClient(transport);

		const payload:CreateProcessTypeInput_GRPC = {
			processTypeStatus:input.processTypeStatus
		}

		const {response} = await client.createProcessTypeGRPC(payload);
		console.log("Response! " + response)

but getting :

TypeError: globalThis.Headers is not a constructor at TwirpFetchTransport.unary 

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Guide (proto3) | Protocol Buffers - Google Developers
The Any message type lets you use messages as embedded types without having their .proto definition. An Any contains an arbitrary serialized message...
Read more >
protobuf/any.proto at main - GitHub
Protocol Buffers - Google's data interchange format - protobuf/any.proto at main ... Redistribution and use in source and binary forms, with or without....
Read more >
Importing any.proto in .proto files - Google Groups
syntax = "proto3"; import "/google/protobuf/any.proto"; message Test { Any var1 ... I am using python 3.5 and have protobuf 3.5.2 installed.
Read more >
Using google.protobuf.Any in python file - Stack Overflow
CopyFrom(some_any) . ...you'll need a . proto file which describes some message type that has integer fields named a and b . Personally,...
Read more >
Protobuf Any and Oneof fields for variant types - Microsoft Learn
Protocol Buffer (Protobuf) provides two simpler options for dealing with values that might be of more than one type. The Any type can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found