ENOENT error for valid proto files
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
- Domain
- cli
Research direction
Start with the failing command and the stack-trace entries in pbf/bin/pbf and resolve-protobuf-schema/index.js, then inspect how the import in foo/models/v1/test.proto is resolved. Reproduce the ENOENT with the shown proto files; done means the valid import no longer produces a duplicated foo/models/v1 path.
Written by the indexing model from the issue text.
Description
I've been using protobufjs and other tools for other languages, and everything is working great so far.
I wanted to try swapping protobufjs for pbf, but pbf has an issue with the proto files.
At the top of one of my files, I have
// test.proto
syntax = "proto3";
package foo.models.v1;
import "foo/models/v1/Common.proto";
but then when I run ./node_modules/.bin/pbf ./foo/models/v1/test.proto > example.js I get an error:
❯ ./node_modules/.bin/pbf ./foo/models/v1/test.proto > example.js
internal/fs/utils.js:220
throw err;
^
Error: ENOENT: no such file or directory, open '/Users/trusktr/src/test-data-models/foo/models/v1/foo/models/v1/Common.proto'
at Object.openSync (fs.js:440:3)
at Object.readFileSync (fs.js:342:35)
at readSync (/Users/trusktr/src/test-data-models/node_modules/resolve-protobuf-schema/index.js:14:23)
at /Users/trusktr/src/test-data-models/node_modules/resolve-protobuf-schema/index.js:18:22
at Array.forEach (<anonymous>)
at Function.readSync [as sync] (/Users/trusktr/src/test-data-models/node_modules/resolve-protobuf-schema/index.js:17:11)
at Object.<anonymous> (/Users/trusktr/src/test-data-models/node_modules/pbf/bin/pbf:13:32)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/Users/trusktr/src/test-data-models/foo/models/v1/foo/models/v1/Common.proto'
}
As you can see, it is repeating part of the path twice (foo/models/v1/foo/models/v1).
As far as I can tell, our proto files are all valid, as they've worked with all of our tools for all our languages so far, just not with pbf due to the above error.
Any ideas?
- Dominant language
- JavaScript
- Stars
- 881
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/pbf
-
question
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
bug question
Difficulty 4/5 3-5 days Newbie friendliness 40/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·