Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relay-compiler --watchman false option fails with FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. when --src is current directory #2042

Open
stevehollaar opened this issue Aug 17, 2017 · 13 comments
Labels

Comments

@stevehollaar
Copy link

stevehollaar commented Aug 17, 2017

Using version 1.2.0

This seems to only happen when src is the current directory: .

./node_modules/.bin/relay-compiler --src . --schema ./schema.json --watchman false                                                         Thu 17 Aug 11:11:25 2017
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: node::Abort() [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 3: v8::V8::ToLocalEmpty() [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 4: node::ReadDir(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 5: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 6: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 7: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/stevehollaar1/.nvm/versions/node/v8.4.0/bin/node]
 8: 0x3e92849840dd
fish: './node_modules/.bin/relay-compi…' terminated by signal SIGABRT (Abort)

Setting src to a subdirectory works as expected:

node_modules/.bin/relay-compiler --src app --schema ./schema.json --watchman false                                                1538ms  Thu 17 Aug 11:14:01 2017
HINT: pass --watch to keep watching for changes.
Parsed default in 0.03s

Writing default
Writer time: 0.52s [0.43s compiling, 0.09s generating, 0.00s extra]
Unchanged: 133 files
Written default in 0.57s
@stevehollaar stevehollaar changed the title relay-compiler --watchman false option fails with FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. when src is current directory relay-compiler--watchman false option fails with FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. when --src is current directory Aug 17, 2017
@stevehollaar stevehollaar changed the title relay-compiler--watchman false option fails with FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. when --src is current directory relay-compiler --watchman false option fails with FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. when --src is current directory Aug 17, 2017
edvinerikson referenced this issue Aug 30, 2017
Summary:
Fixes #1644

This PR will update relay-compiler to not use watchman unless watching files.
Closes #1966

Reviewed By: asiandrummer

Differential Revision: D5522984

Pulled By: leebyron

fbshipit-source-id: 5c18f9e03691a542d9c77b9c1858a734ed6b6792
@oguzbilgic
Copy link

I can confirm this on v1.4.1

@oguzbilgic
Copy link

@stevehollaar did you find a workaround for this?

@simenbrekken
Copy link

I started digging a bit into this and found that readdir-enhanced which fast-glob utilizes recurses into every directory starting from src including node_modules.

The filtering as specified by exclude seems to be performed after reading everything. I suspect symlinks inside of node_modules could be the culprit but I wasn't able to pinpoint the root cause.

My current workaround for a next.js project is explicitly specifying source directories relative to src: relay-compiler --src . --include components/** --include pages/**

@pranaygp
Copy link
Contributor

pranaygp commented Jan 11, 2018

cc @robrichard @leebyron (#1966)

I can't think of a smart way to fix this based on @simenbrekken's observations. Any thoughts on this?

If nothing else, I think specifically showing a descriptive error message when --src === "." and the "--exclude" option is used like this could be useful (as a last resort):

You cannot use "--src ." in conjunction with the "--exclude" flag, please use "--include" instead or move your source files into a dedicated source directory"

@robrichard
Copy link
Contributor

I think this was working with node 6, but is broken now with node 8. I opened an issue in the fast-glob repo: mrmlnc/fast-glob#23

grahammendick added a commit to grahammendick/navigation that referenced this issue Feb 5, 2018
It complained that Watchman wasn't installed (even though wasn't relay-compiling with --watch). Needed to update relay packages and move run relay-compile against sub folder (facebook/relay#2042)
facebook-github-bot pushed a commit that referenced this issue Feb 6, 2018
Summary:
* #2042
  * mrmlnc/fast-glob#23

  * Fix for #2042. Now works fine with more then 500 000 entries (maybe more – more I have not tried).
  * Also this is a [new release of `fast-glob` package](https://github.com/mrmlnc/fast-glob/releases/tag/2.0.0), which became even faster and more stable.

  * If you want exclude `node_modules` directory you can use `**/node_modules` pattern ([documentation](https://github.com/mrmlnc/fast-glob#how-to-exclude-directory-from-reading)).

Sorry for the problems from #2042.
Closes #2295

Reviewed By: kassens

Differential Revision: D6770665

Pulled By: jstejada

fbshipit-source-id: dcc0920c75aed32ca0b1d9d34aa6b1fdbeda95be
@steida
Copy link

steida commented Feb 24, 2018

watchman option still does not work.

@jstejada
Copy link
Contributor

@steida, what do you mean that it still doesn't work? Which version of node are you running? Did you try @simenbrekken's workaround?

steida added a commit to este/este that referenced this issue Feb 27, 2018
@steida
Copy link

steida commented Feb 27, 2018

Yes, I tried. Node 8.9.4. With --watchman false I get: (both locally and in circle ci)

screen shot 2018-02-28 at 00 34 26

@steida
Copy link

steida commented Feb 27, 2018

Why is watchman needed without watching anyway? Does anybody know how to install it on circle-ci 2? Thank you.

@steida
Copy link

steida commented Feb 28, 2018

You can check it here: https://github.com/este/este

@mrmlnc
Copy link
Contributor

mrmlnc commented Feb 28, 2018

Hello, @steida,

Unfortunately, this does not looks like a bug inside my package (fast-glob).

I see that you trying to pass the following set of patterns to the fast-glob package:

[ 'components/A.js/*.+(js)',
  'components/AreYouSureConfirm.js/*.+(js)',
  // …
  'components/editor/*.+(js)',
  'mutations/CreateWebMutation.js/*.+(js)',
  // …
  'mutations/utils/*.+(js)',
  'pages/__generated__/*.+(js)',
  // …
  'pages/sign-in.js/*.+(js)' ]

But I see that you have the following tree on the file system:

./components/
├── A.js
├── AreYouSureConfirm.js
├── …
├── WebsItem.js
├── __generated__
│   ├── …
│   └── WebsItem.graphql.js
├── app
│   ├── …
│   └── index.js
├── buttons.js
└── editor
    ├── …
    └── logReducer.js

When you pass a pattern like components/A.js/*.+(js), then you say that you want to find all files with .js extension inside the components/A.js directory.

JFYI: This is the Task that was created for your pattern:

{
  base: 'components/A.js', // The parent directory 
  dynamic: true,
  patterns: [
    'components/A.js/*.+(js)',
    '!**/node_modules',
    '!**/__mocks__',
    '!**/__tests__',
    '!**/__generated__'
  ],
  positive: [
    'components/A.js/*.+(js)'
  ],
  negative: [
    '**/node_modules',
    '**/__mocks__',
    '**/__tests__',
    '**/__generated__'
  ]
}

This issue related to wildcards inside npm scripts. Before sending the patterns to the script, they are expanded by shell. You should wrap the patterns in quotation marks:

relay-compiler --src . --include 'components/**' 'mutations/**' 'pages/**' --schema server/schema.graphql,

Or "" if you use Windows also.

After it all works fine:

[ 'components/**/*.+(js)',
  'mutations/**/*.+(js)',
  'pages/**/*.+(js)' ]

steida added a commit to este/este that referenced this issue Feb 28, 2018
@steida
Copy link

steida commented Feb 28, 2018

@mrmlnc Wow, it works. Finally, :-) Thank you ❤️

@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants