TypeError:无法读取未定义的属性“类型”

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TypeError:无法读取未定义的属性“类型”相关的知识,希望对你有一定的参考价值。

我很困惑,因为我对这个基本教程有问题 - > https://www.howtographql.com/graphql-ruby/4-authentication/

我使用本教程将所有查询移动到另一个文件夹(如突变) - > https://itnext.io/graphql-with-ruby-on-rails-queries-in-multiple-files-3a7b818354a2

我在GraphiQL控制台中遇到错误:

TypeError: Cannot read property 'types' of undefined
    at buildClientSchema (http://localhost:4000/assets/graphiql/rails/application-6f03c7a92432765b0fbe671bfb7a292ee6c37e6704b6e6ac95587e45676bbf72.js:34102:72)
    at http://localhost:4000/assets/graphiql/rails/application-6f03c7a92432765b0fbe671bfb7a292ee6c37e6704b6e6ac95587e45676bbf72.js:2795:55

应用程序/ graphql / backend_schema.rb

class BackendSchema < GraphQL::Schema
  mutation(Types::MutationType)
  query(Types::QueryType)
end

应用程序/ graphql /类型/ user_type.rb

module Types
  class UserType < Types::BaseObject
    field :id, ID, null: false
    field :name, String, null: false
    field :email, String, null: false
  end
end

应用程序/ graphql /类型/ query_type.rb

module Types
  class QueryType < Types::BaseObject
     field :get_all_users, resolver: Queries::GetAllUsers
  end
end

应用程序/ graphql /查询/ base_queries.rb

module Queries
  class BaseQuery < GraphQL::Schema::Resolver
    # null false
  end
end

应用程序/ graphql /查询/ get_all_users.rb

module Queries
  class GetAllUsers < Queries::BaseQuery
    type [Types::UserType], null: false

    def get_all_users
      User.all
    end
  end
end

来自控制台的日志:

backend git:(master) rails s -p 4000
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.2-p47), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:4000
Use Ctrl-C to stop
Started GET "/graphiql" for ::1 at 2019-04-07 12:55:21 +0100
   (0.7ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
  ↳ /Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Processing by GraphiQL::Rails::EditorsController#show as html
  Parameters: "graphql_path"=>"/graphql"
  Rendering /Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/graphiql-rails-1.7.0/app/views/graphiql/rails/editors/show.html.erb
  Rendered /Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/graphiql-rails-1.7.0/app/views/graphiql/rails/editors/show.html.erb (166.0ms)
Completed 200 OK in 171ms (Views: 169.2ms | ActiveRecord: 0.0ms)


Started POST "/graphql" for ::1 at 2019-04-07 12:55:22 +0100
Processing by GraphqlController#execute as */*
  Parameters: "query"=>"\n    query IntrospectionQuery \n      __schema \n        queryType  name \n        mutationType  name \n        subscriptionType  name \n        types \n          ...FullType\n        \n        directives \n          name\n          description\n          locations\n          args \n            ...InputValue\n          \n        \n      \n    \n\n    fragment FullType on __Type \n      kind\n      name\n      description\n      fields(includeDeprecated: true) \n        name\n        description\n        args \n          ...InputValue\n        \n        type \n          ...TypeRef\n        \n        isDeprecated\n        deprecationReason\n      \n      inputFields \n        ...InputValue\n      \n      interfaces \n        ...TypeRef\n      \n      enumValues(includeDeprecated: true) \n        name\n        description\n        isDeprecated\n        deprecationReason\n      \n      possibleTypes \n        ...TypeRef\n      \n    \n\n    fragment InputValue on __InputValue \n      name\n      description\n      type  ...TypeRef \n      defaultValue\n    \n\n    fragment TypeRef on __Type \n      kind\n      name\n      ofType \n        kind\n        name\n        ofType \n          kind\n          name\n          ofType \n            kind\n            name\n            ofType \n              kind\n              name\n              ofType \n                kind\n                name\n                ofType \n                  kind\n                  name\n                  ofType \n                    kind\n                    name\n                  \n                \n              \n            \n          \n        \n      \n    \n  ", "graphql"=>"query"=>"\n    query IntrospectionQuery \n      __schema \n        queryType  name \n        mutationType  name \n        subscriptionType  name \n        types \n          ...FullType\n        \n        directives \n          name\n          description\n          locations\n          args \n            ...InputValue\n          \n        \n      \n    \n\n    fragment FullType on __Type \n      kind\n      name\n      description\n      fields(includeDeprecated: true) \n        name\n        description\n        args \n          ...InputValue\n        \n        type \n          ...TypeRef\n        \n        isDeprecated\n        deprecationReason\n      \n      inputFields \n        ...InputValue\n      \n      interfaces \n        ...TypeRef\n      \n      enumValues(includeDeprecated: true) \n        name\n        description\n        isDeprecated\n        deprecationReason\n      \n      possibleTypes \n        ...TypeRef\n      \n    \n\n    fragment InputValue on __InputValue \n      name\n      description\n      type  ...TypeRef \n      defaultValue\n    \n\n    fragment TypeRef on __Type \n      kind\n      name\n      ofType \n        kind\n        name\n        ofType \n          kind\n          name\n          ofType \n            kind\n            name\n            ofType \n              kind\n              name\n              ofType \n                kind\n                name\n                ofType \n                  kind\n                  name\n                  ofType \n                    kind\n                    name\n                  \n                \n              \n            \n          \n        \n      \n    \n  "
uninitialized constant Queries::BaseQuery
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
/Users/qwerty/projects/backend/app/graphql/queries/get_all_users.rb:2:in `<module:Queries>'
/Users/qwerty/projects/backend/app/graphql/queries/get_all_users.rb:1:in `<main>'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
/Users/qwerty/projects/backend/app/graphql/types/query_type.rb:3:in `<class:QueryType>'
/Users/qwerty/projects/backend/app/graphql/types/query_type.rb:2:in `<module:Types>'
/Users/qwerty/projects/backend/app/graphql/types/query_type.rb:1:in `<main>'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
/Users/qwerty/projects/backend/app/graphql/backend_schema.rb:3:in `<class:BackendSchema>'
/Users/qwerty/projects/backend/app/graphql/backend_schema.rb:1:in `<main>'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
/Users/qwerty/projects/backend/app/controllers/graphql_controller.rb:10:in `execute'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/base.rb:194:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:98:in `run_callbacks'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/callbacks.rb:41:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/rescue.rb:22:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:168:in `block in instrument'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:168:in `instrument'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activerecord-5.2.3/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/base.rb:134:in `process'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:191:in `dispatch'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:252:in `dispatch'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35:in `each'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35:in `serve'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:840:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/etag.rb:25:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/conditional_get.rb:38:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activerecord-5.2.3/lib/active_record/migration.rb:559:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:98:in `run_callbacks'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/rack/logger.rb:38:in `call_app'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/rack/logger.rb:26:in `block in call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb:28:in `tagged'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb:71:in `tagged'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/rack/logger.rb:26:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/runtime.rb:22:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/middleware/static.rb:127:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rack-cors-1.0.3/lib/rack/cors.rb:95:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:524:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'
/Users/qwerty/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'
Completed 500 Internal Server Error in 12ms (Views: 0.9ms | ActiveRecord: 0.0ms)

链接到我的仓库中的graphql文件夹 - > https://github.com/paw3lgora/backend/tree/master/app/graphql

感谢帮助!

答案

我从你的git repo中提取代码。我没有使用graphql,但你显然没有正确构建你的模块和类。你的应用程序有用吗?我建议你从一个新项目开始,如果你在this tutorial工作,从一开始就开始

但是你可能会更好地使用新的rails项目,一步一步阅读documentation here

以上是关于TypeError:无法读取未定义的属性“类型”的主要内容,如果未能解决你的问题,请参考以下文章

TypeError:无法读取未定义的属性“分支”

TypeError:无法读取未定义的属性“getters”

(节点:47028)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“表情符号”

TypeError:无法读取未定义的属性“类型”

NextJS:TypeError:无法读取未定义的属性“json”

TypeError:无法使用 TSLint 和 TypeScript 读取未定义的属性“getFullWidth”