Giter VIP home page Giter VIP logo

Comments (38)

gregology avatar gregology commented on July 18, 2024 20

Is everyone with this issue running production on Google Cloud Platform?
👍 for yes 👎 for no
I'm not sure if GCP is respecting NODE_ENV: production from the app.yaml file when precompiling assets. I was following advice from howtographql/react-apollo#33 (comment)

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024 6

@leechunhoe you need to update your production environment and set your js_compressor like this:

config.assets.js_compressor = Uglifier.new(harmony: true)

Don't forget to require 'uglifier'

Concerning the Topic:
1.6.x is still causing the initial mentioned Bug in Production for me.

from graphiql-rails.

aperaham avatar aperaham commented on July 18, 2024 6

In my case, the issue involved Uglifier mangling variables in the javascript file. The following settings appear to work:

config.assets.js_compressor = Uglifier.new(harmony: true, mangle: false)

Make sure to update Uglifier to a version that supports the mangle option.

from graphiql-rails.

saiidalhalawi avatar saiidalhalawi commented on July 18, 2024 5

The same issue has occurred on Heroku.

graphiql-rails (1.7.0)
graphql (1.9.3)

from graphiql-rails.

michaelbina avatar michaelbina commented on July 18, 2024 4

For anyone else that gets here, the combination of

config.assets.js_compressor = Uglifier.new(harmony: true, mangle: false)

and

gem 'graphql'
gem 'graphiql-rails', '~> 1.5.0'

worked for me

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024 2

hmm upgraded to 1.7 did not change the error for me.

from graphiql-rails.

xiaocuixt avatar xiaocuixt commented on July 18, 2024 2

Just Worked with the old version 😭 :

    gem 'graphql', '~> 1.9.2'
    gem 'graphiql-rails', '~> 1.4.11'

from graphiql-rails.

stanhu avatar stanhu commented on July 18, 2024 2

We just came across this in GitLab as well (https://gitlab.com/gitlab-org/gitlab-ce/issues/67293).

As described in graphql/graphql-js#1182 (comment):

So, as far as I can see the problem is that GraphQLScalarType and GraphQLObjectType constructors both get e as a shortcut during the minifying. And when graphql-js tries to compare them — condition is true and it throws an error.

Disabling name mangling in UglifyJsPlugin via mangle: false sounds like a possible workaround, but this may bloat the size of the JavaScript output.

graphql-js added a fix to disable this check when NODE_ENV is set to production (graphql/graphql-js#1174).

Normally, Webpack will set NODE_ENV properly and generate assets accordingly. However, if you are using Sprockets, NODE_ENV is never set to anything, so this check always gets hit if name mangling is in use.

Perhaps this gem is no longer needed now that Rails 5 defaults to Webpacker (https://github.com/rails/webpacker). For those of us not using Webpacker, I wonder if we can work around this by defining a NODE_ENV inside or patching the graphql-js code during asset compilation.

from graphiql-rails.

gregology avatar gregology commented on July 18, 2024 1

I'm also having this issue. The error is not occurring in development, only in production.

gem 'graphql',                      '~> 1.8.11'
gem 'graphiql-rails',               '~> 1.5.0'

from graphiql-rails.

leechunhoe avatar leechunhoe commented on July 18, 2024 1

graphiql-rails 1.6.0, graphql 1.8.11 works okay in development, but shows following error when build production.

Uglifier::Error: In strict mode code, functions can only be declared at top level or immediately within another function.
/var/app/current/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:234:in `parse_result'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:216:in `run_uglifyjs'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.20/lib/uglifier.rb:168:in `compile'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/var/app/current/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:30:in `block in <main>'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024 1

Ah no problem i only read the notification mail which did not include the link ^^

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024 1

We removed graphiql-rails from our Apps and are now using a html only version of the GraphiQL Playground from Prisma https://github.com/prisma/graphql-playground

The next step would be to use the React Component to build a customized Playground with Subscription support like you would get when you use Apollo Server or Absinthe from Elixir but in this case for Rails with ActionCable

from graphiql-rails.

eric-khoury avatar eric-khoury commented on July 18, 2024 1

@mortik In that case, have you tried Altair?
No integration within the app, just connect directly to any graphql endpoint, has subscriptions, etc.

from graphiql-rails.

jessecurry avatar jessecurry commented on July 18, 2024 1

I'm experiencing this issue on Heroku and have been able to duplicate locally in production mode. Using mangle: false did not resolve my issue.

Is there a long term fix in the works?

from graphiql-rails.

marckohlbrugge avatar marckohlbrugge commented on July 18, 2024 1

Since the gem doesn't seem to maintained anymore, does anyone have successfully implemented graphiql using webpacker?

from graphiql-rails.

yask123 avatar yask123 commented on July 18, 2024 1

We stopped using this gem and just directly use graphiql-js library.

from graphiql-rails.

nsikanikpoh avatar nsikanikpoh commented on July 18, 2024 1

Just Worked with the old version :

    gem 'graphql', '~> 1.9.2'
    gem 'graphiql-rails', '~> 1.4.11'

This works for me as well Thanks

from graphiql-rails.

rmosolgo avatar rmosolgo commented on July 18, 2024 1

Hey everyone, I hope that upstream fixes and new configurations for the minifier worked alright. If anyone runs into this again, please open a new issue!

from graphiql-rails.

zeroedin avatar zeroedin commented on July 18, 2024

Having the same issue, staging env, not production, but similar as in not a development env.

graphql (1.8.11)
graphiql-rails (1.5.0)

from graphiql-rails.

denisahearn avatar denisahearn commented on July 18, 2024

We also started having this issue in our staging environment once we upgraded to:

graphql (1.8.11)
graphiql-rails (1.5.0)

from graphiql-rails.

marckohlbrugge avatar marckohlbrugge commented on July 18, 2024

Same problem, using these gems:

graphql (1.8.11)
graphiql-rails (1.5.0)

from graphiql-rails.

eric-khoury avatar eric-khoury commented on July 18, 2024

Same issue here:

Using graphql 1.8.13
Using graphiql-rails 1.5.0

from graphiql-rails.

wadewinningham avatar wadewinningham commented on July 18, 2024

I have this issue, but it's in development.

graphiql-rails (1.6.0)
graphql-pro (1.9.5)

Works with graphiql-rails 1.4.11, but I'm getting the error reported here in both 1.5.0 and 1.6.0.

from graphiql-rails.

gregology avatar gregology commented on July 18, 2024

Forgive my ignorance but will updating to production React fix this issue?

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024

No this fixes only the issue @leechunhoe posted

from graphiql-rails.

gregology avatar gregology commented on July 18, 2024

Sorry @mortik, I was referring to PR #61, not the updates to production environment you suggested above. I'd try it out but I don't have a production app that I can risk breaking atm :(

from graphiql-rails.

leechunhoe avatar leechunhoe commented on July 18, 2024

Thank you @mortik, the errors fixed. Though graphiql still won't load on production.

from graphiql-rails.

mortik avatar mortik commented on July 18, 2024

yeah sadly still need to set 'graphiql-rails', '~> 1.4.11'

from graphiql-rails.

gregology avatar gregology commented on July 18, 2024

It looks like #61 has fixed the issue. 1.7.0 now works for me 👍

gem 'graphql',                      '~> 1.8.13'
gem 'graphiql-rails',               '~> 1.7.0'

from graphiql-rails.

gregology avatar gregology commented on July 18, 2024

Yes, disregard, it was just a slow propagation issue. Sorry if anyone deployed. Back to 1.4.11

from graphiql-rails.

wadewinningham avatar wadewinningham commented on July 18, 2024

The update did not fix my issue either, but I'm not sure if graphql-pro is behind.

from graphiql-rails.

isaacrowntree avatar isaacrowntree commented on July 18, 2024

Still not fixed (not on GCP):

gem 'graphql', '~> 1.8.13'
gem 'graphql-client', '~> 0.14.0'
gem 'graphql-errors', '~> 0.3.0'
gem 'graphiql-rails', '~> 1.7'

from graphiql-rails.

G-shuu avatar G-shuu commented on July 18, 2024

for me same issue

graphiql-rails (1.5.0)
graphql (1.8.13)

from graphiql-rails.

davelooi avatar davelooi commented on July 18, 2024

This has been happening since Nov 2018.
Does anyone has a workaround for this? Other than locking to 1.4.

Is there a plan to fix this in the future? Anything we can do to help?

from graphiql-rails.

blevine avatar blevine commented on July 18, 2024

I am seeing the same issue. Anyone have a fix?

from graphiql-rails.

mcelicalderon avatar mcelicalderon commented on July 18, 2024

I did not try mangle: false, but problem persists on v1.7.0 using the harmony: true option on Uglifier. I just went ahead and downgraded to v1.4.11 of this gem as @a-barbieri originally pointed out that works. Kept harmony: true option

from graphiql-rails.

duffyjp avatar duffyjp commented on July 18, 2024

@yask123 Can you give some pointers on how you did that? I'm in the same boat.

from graphiql-rails.

andrew-gregory-genedx avatar andrew-gregory-genedx commented on July 18, 2024
gem 'graphql', ~> '1.11.4'
gem 'graphql-rails', ~> '1.4.11'

worked for me. gem 'graphql-rails', ~> '1.5.0' did not work.

I believe this root issue is also solved by this PR in graphql-js.

The error I was getting was the same, except e "__Schema", not t "__Schema".

from graphiql-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.