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.

Unable to import proto file that depends upon another protofile

See original GitHub issue

Describe the bug I have a proto file, a.proto, that has a dependency upon a message in a different proto file, b.proto. To get around this, I am forced to move all of my proto definitions into one file.

To Reproduce Steps to reproduce the behavior: Simplified version: b.proto

message FooStruct {
  string foo = 1;
}

a.proto

message BarStruct {
  string bar = 1;
  Foostruct imported_struct = 2;
}

Try to import a.proto and receive the following (I have omitted my actual file names and substituted the above)

Error: no such Type or Enum 'FooStruct' in Type BarStruct
    at Type.lookupTypeOrEnum (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86897:15)
    at Field.resolve (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:74747:94)
    at Type.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:114185:21)
    at Namespace.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Namespace.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Namespace.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Namespace.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Namespace.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Root.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:86794:25)
    at Root.resolveAll (file:///Applications/Insomnia.app/Contents/Resources/app.asar/bundle.js:115345:43)


**Expected behavior**
I should be able to import proto files that have imports from other proto files.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
Version: Insomnia 2021.3.0-beta.1
Release date: 4/21/2021
OS: Darwin x64 19.6.0
Electron: 9.3.5
Node: 12.14.1
V8: 8.3.110.13-electron.0
Architecture: x64
node-libcurl: libcurl/7.73.0 OpenSSL/1.1.1j zlib/1.2.11 brotli/1.0.9 zstd/1.4.9 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.41.0

**Additional context**
Add any other context about the problem here.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
fabitamascommented, Apr 11, 2022

It is not always possible to load the parent folder. Some projects rely on other open source projects, for example I’m importing timestamp from google:

import “google/protobuf/timestamp.proto”;

Is this not supported by Insomnia?

0reactions
develohpandacommented, May 1, 2021

@sasidakh that seems to be unrelated (maybe OS specific), could you please open another issue (and share your OS details) please? Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

protocol buffers - Error using import in .proto file
ProtoRoot should just be a relative path from the .csproj to the directory of protos. Once you do this, you can directly import...
Read more >
How to import validate/validate.proto into .proto file using ...
Importing validate.proto into your source proto file is the first step to annotate your source schemas. It will involve copy-pasting validate.
Read more >
Problem Compiling nested proto files that do not reside in ...
My Scenario: I have defined four proto message types: A, B, C, D and want to compile using the C++ option. Proto file...
Read more >
Go Frequently Asked Questions | Protocol Buffers
This typically occurs when a .proto file is vendored and a Go package is generated from it, or the generated Go package itself...
Read more >
Go Protobuf Tips
As long as your proto file imports are all relative to the current directory, ... if you have another proto file that depends...
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