Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

A crash in the task that continues `HttpClient.send` is lost

Ouverte
#76 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
68/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
javascript, node.js
Domaine
backend

Piste de recherche

Start with the HttpClient.send implementation and its fetch promise chain, focusing on the .then and .catch callbacks that invoke the scheduler. Reproduce the issue with src/Main.gren and run.sh, then add coverage using a task that throws after the response. Done means that task crash is reported normally and is not converted into a failed request or silently discarded.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Repository: gren-lang/node
Found against: gren 0.6.6, gren-lang/core 7.6.0, gren-lang/node 6.2.0
(and main at 982f87c), node 2

Summary

_HttpClient_request answers the scheduler from inside fetch's promise
chain, and the chain ends in a .catch that turns an error into a failed
request:

fetch(...)
  .then((res) => { ... return callback(__Scheduler_succeed(...)); })
  .catch((e) => { ... return callback(__Scheduler_fail(...)); });

callback steps the process there and then, so the task that continues the
response runs inside the .then. A crash there, a Debug.todo or a throw from
kernel code, is caught by the .catch as though the request had failed. The
second callback finds the binding already answered, and the crash is gone:
the program ends with nothing on stderr.

task after send prints should print
Task.andThen (\_ -> Debug.todo "after the response") nothing Error: TODO in module \Main` on line 19`
the same, after Task.succeed {} in place of the request Error: TODO in module \Main` on line 19` the same

Reproduction

~/prj/gren-bug-reports/2026-10-12-httpclient-crash-after-response: ./run.sh
builds and runs src/Main.gren under devbox, which provides gren 0.6.6 and
node 22:

main : Node.SimpleProgram a
main =
    Node.defineSimpleProgram <| \env ->
        Init.await HttpClient.initialize <| \http ->
            Node.endSimpleProgram
                (HttpClient.get "data:text/plain,hello"
                    |> HttpClient.expectString
                    |> HttpClient.send http
                    |> Task.andThen (\_ -> Debug.todo "after the response")
                    |> Task.onError (\_ -> Stream.writeLineAsBytes "the request failed" env.stdout |> Task.map (\_ -> {}) |> Task.onError (\_ -> Task.succeed {}))
                )

It prints nothing. Replacing the three HttpClient lines with Task.succeed {}
prints the TODO.

Langage dominant
JavaScript
Étoiles
13
Forks
6
Merge moyen
2 j 4 h
PR mergées (30 j)
2

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de gren-lang/node

Toutes les issues de gren-lang/node

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.