Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

UnhandledPromiseRejectionWarning: Unhandled promise rejection #781

Open
@hyphen1370

Description

@hyphen1370

Hello,

I follow this link to create a simple express-graphql server:
https://graphql.org/graphql-js/running-an-express-graphql-server/

When I start the server, I got this error:
(node:23847) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of null
[2021-09-28T19:52:22.167Z] at ServerResponse._send (http_outgoing.js:322:33)
[2021-09-28T19:52:22.167Z] at write
(_http_outgoing.js:744:15)
[2021-09-28T19:52:22.167Z] at ServerResponse.write (_http_outgoing.js:687:15)
[2021-09-28T19:52:22.168Z] at writetop (/mnt/d/AzureFunctions/OMAXITToolsFrontend/node_modules/express-session/index.js:295:26)
[2021-09-28T19:52:22.168Z] at ServerResponse.end (/mnt/d/AzureFunctions/OMAXITToolsFrontend/node_modules/express-session/index.js:356:16)
[2021-09-28T19:52:22.168Z] at ServerResponse.send (/mnt/d/AzureFunctions/OMAXITToolsFrontend/node_modules/express/lib/response.js:221:10)
[2021-09-28T19:52:22.169Z] at ServerResponse.json (/mnt/d/AzureFunctions/OMAXITToolsFrontend/node_modules/express/lib/response.js:267:15)
[2021-09-28T19:52:22.169Z] at graphqlMiddleware (/mnt/d/AzureFunctions/OMAXITToolsFrontend/node_modules/express-graphql/index.js:198:22)
[2021-09-28T19:52:22.169Z] (node:23847) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)[2021-09-28T19:52:22.169Z] Executed 'Functions.OMAXITToolsFrontend' (Succeeded, Id=04dce77a-4e8e-40fe-ab7e-819666ec5d04, Duration=614ms)

[2021-09-28T19:52:22.170Z] (node:23847) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How could I make this error disappear or put a try and catch block to stop the warning?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions