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

Build process is breaking GraphQL endpoint when running SAM Local #68

Open
bardzh opened this issue Nov 15, 2021 · 0 comments
Open

Build process is breaking GraphQL endpoint when running SAM Local #68

bardzh opened this issue Nov 15, 2021 · 0 comments
Labels
question Further information is requested

Comments

@bardzh
Copy link

bardzh commented Nov 15, 2021

I started a project with this plugin, it works great with normal routes but when i added apollo-server-lambda to the project firstly i got a whole bunch of warnings during the build process.

asset ./.aws-sam/build/myFunction/app.js 1.68 MiB [emitted] [minimized] (name: myFunction) 2 related assets
orphan modules 457 KiB [orphan] 121 modules
runtime modules 1.04 KiB 5 modules
cacheable modules 3.29 MiB
  javascript modules 2.78 MiB 429 modules
  json modules 516 KiB
    modules by path ./node_modules/iconv-lite/ 86.7 KiB 8 modules
    ./node_modules/apollo-server-core/package.json 1.29 KiB [built] [code generated]
    ./node_modules/statuses/codes.json 1.54 KiB [built] [code generated]
    ./node_modules/mime-db/db.json 142 KiB [built] [code generated]
    ./node_modules/mime/types.json 30.8 KiB [built] [code generated]
    ./node_modules/node-fetch/node_modules/tr46/lib/mappingTable.json 254 KiB [built] [code generated]
18 modules

WARNING in ./node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/express/lib/application.js 22:11-28
 @ ./node_modules/express/lib/express.js 18:12-36
 @ ./node_modules/express/index.js 11:0-41
 @ ./node_modules/apollo-server-lambda/dist/ApolloServer.js 27:34-52
 @ ./node_modules/apollo-server-lambda/dist/index.js 13:21-46
 @ ./src/my-function/app.js 1:30-61

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.64.0 compiled with 1 warning in 10672 ms

secondly when i run sam local start-api to access the endpoint i get these errors

2021-11-15T04:41:49.872Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: \"SchemaDefinition\", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.","stack":["Error: Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: \"SchemaDefinition\", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.","    at t.assertSchema (/var/task/app.js:16:286088)","    at h (/var/task/app.js:16:291337)","    at t.assertValidSchema (/var/task/app.js:16:291027)","    at O (/var/task/app.js:16:172522)","    at _ (/var/task/app.js:16:171621)","    at t.execute (/var/task/app.js:16:170733)","    at t.generateSchemaHash (/var/task/app.js:16:36413)","    at u.generateSchemaDerivedData (/var/task/app.js:2:274813)","    at Object.schemaDerivedDataProvider (/var/task/app.js:2:270181)","    at new t.SchemaManager (/var/task/app.js:16:39283)"]}
time="2021-11-15T04:41:49.899" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 129"
2021-11-15T04:41:50.172Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: \"SchemaDefinition\", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.","stack":["Error: Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: \"SchemaDefinition\", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.","    at t.assertSchema (/var/task/app.js:16:286088)","    at h (/var/task/app.js:16:291337)","    at t.assertValidSchema (/var/task/app.js:16:291027)","    at O (/var/task/app.js:16:172522)","    at _ (/var/task/app.js:16:171621)","    at t.execute (/var/task/app.js:16:170733)","    at t.generateSchemaHash (/var/task/app.js:16:36413)","    at u.generateSchemaDerivedData (/var/task/app.js:2:274813)","    at Object.schemaDerivedDataProvider (/var/task/app.js:2:270181)","    at new t.SchemaManager (/var/task/app.js:16:39283)"]}
END RequestId: 97ac0299-a32b-4254-a9ad-d2e8fe665e72
REPORT RequestId: 97ac0299-a32b-4254-a9ad-d2e8fe665e72	Init Duration: 0.21 ms	Duration: 601.23 ms	Billed Duration: 602 ms	Memory Size: 128 MB	Max Memory Used: 128 MB
Lambda returned empty body!
Invalid lambda response received: Invalid API Gateway Response Keys: {'errorType', 'trace', 'errorMessage'} in {'errorType': 'Error', 'errorMessage': 'Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: "SchemaDefinition", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.', 'trace': ['Error: Expected { __validationErrors: undefined, description: undefined, extensions: undefined, astNode: { kind: "SchemaDefinition", operationTypes: [Array] }, extensionASTNodes: [], _queryType: Query, _mutationType: undefined, _subscriptionType: undefined, _directives: [@include, @skip, @deprecated, @specifiedBy], _typeMap: { Query: Query, String: String, Boolean: Boolean, __Schema: __Schema, __Type: __Type, __TypeKind: __TypeKind, __Field: __Field, __InputValue: __InputValue, __EnumValue: __EnumValue, __Directive: __Directive, __DirectiveLocation: __DirectiveLocation }, _subTypeMap: {}, _implementationsMap: {} } to be a GraphQL schema.', '    at t.assertSchema (/var/task/app.js:16:286088)', '    at h (/var/task/app.js:16:291337)', '    at t.assertValidSchema (/var/task/app.js:16:291027)', '    at O (/var/task/app.js:16:172522)', '    at _ (/var/task/app.js:16:171621)', '    at t.execute (/var/task/app.js:16:170733)', '    at t.generateSchemaHash (/var/task/app.js:16:36413)', '    at u.generateSchemaDerivedData (/var/task/app.js:2:274813)', '    at Object.schemaDerivedDataProvider (/var/task/app.js:2:270181)', '    at new t.SchemaManager (/var/task/app.js:16:39283)']}
2021-11-15 12:41:50 127.0.0.1 - - [15/Nov/2021 12:41:50] "POST /graphql HTTP/1.1" 502 -

OS: Mac OS 12.0.1
Node: 14.17.6

i've attached the project here

When i start a SAM , SAM build, etc. project i don't get these issues.
app.zip

@buggy buggy added the question Further information is requested label Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants