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

Invalid access of discarded #575

Open
1 of 2 tasks
gabrielcursino opened this issue May 15, 2023 · 2 comments
Open
1 of 2 tasks

Invalid access of discarded #575

gabrielcursino opened this issue May 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@gabrielcursino
Copy link

gabrielcursino commented May 15, 2023

Bug Report

Is you/your team sponsoring this project

  • Yes
  • No

If your team sponsoring this project, please attach here your team lead or who purchased license GitHub login

Minimal reproducible repo

Link here

Current Behavior

A canceled request crashes the service

Expected behavior/code

Canceled requests should not throw errors and crash the service

Environment

  • Node/npm version: Node 16/npm 8
  • OS: Windows 11

Possible Solution

Additional context/Screenshots

Add any other context about the problem here. If applicable, add screenshots to help explain.

Note

  • Project is provided as-is without any support nor warranty
  • If this issue not related to this project and exists on core of this project, please close issue or not open
@gabrielcursino gabrielcursino added the bug Something isn't working label May 15, 2023
@Najsar
Copy link
Contributor

Najsar commented May 29, 2023

add

res.onAborted(() => {
  return false;
});

@gabrielcursino
Copy link
Author

@Najsar unfortunately the error persists

import nanoexpress from 'nanoexpress';

const app = nanoexpress();

app

.get('/test', async (req, res) => {
  req.onAborted(() => false);

  res.onAborted(() => false);

  await new Promise(resolve => setTimeout(() => resolve(), 5000));

  return res.send('success');
});

app.listen(3000);

or

import nanoexpress from 'nanoexpress';

const app = nanoexpress();

app

.get('/test', async (req, res) => {
  req.onAborted(() => res.send('error'));

  res.onAborted(() => res.send('error'));

  await new Promise(resolve => setTimeout(() => resolve(), 5000));

  return res.send('success');
});

app.listen(3000);

not works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants