apollographql / apollographql/apollo-tooling

apollo codegen:generate fails if there is a symlink linking to a directory

Open
#643 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

I typically have a symlink to a build directory, and have needed to remove it to run ``apollo codegen:generate``

```
$ apollo codegen:generate --target=flow
✔ Loading Apollo config
✔ Scanning for GraphQL queries (374 found)
✖ Generating query files with 'flow' target
→ EISDIR: illegal operation on a directory, read
Error: EISDIR: illegal operation on a directory, read
at inputPaths.map.inputPath (~/MyApp/node_modules/apollo-codegen-core/lib/loading.js:87:35)
at Array.map ()
at loadQueryDocuments (~/MyApp/node_modules/apollo-codegen-core/lib/loading.js:83:10)
at Object.loadAndMergeQueryDocuments (~/MyApp/node_modules/apollo-codegen-core/lib/loading.js:138:32)
at Object.generate [as default] (~/MyApp/node_modules/apollo/lib/generate.js:18:32)
at Task.task (~/MyApp/node_modules/apollo/lib/commands/codegen/generate.js:98:64)
at Promise.resolve.then.then.skipped (~/MyApp/node_modules/listr/lib/task.js:167:30)
```

Contributor guide

Open the contributing guide

Research direction

Start with apollo-codegen-core/lib/loading.js around line 87, where the stack trace shows the directory symlink is being read, then inspect the codegen generate entry points in apollo/lib/generate.js and apollo/lib/commands/codegen/generate.js. Reproduce the command with a symlink to a directory and verify that code generation completes without the EISDIR error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.