Search code examples
node.jsangularjsnpmgulp

Gulp crash with an HPE_INVALID_CONSTANT error on first XHR request


I'm developing an AngularJS 1.7.x application (started 3 years ago), and when I started Gulp was the tool to use.

Yesterday, when I resume my work on my app, I suddenly get a crash on the first XHR request.

So I run "gulp serve", it opens chrome with the login page, everything is loading correctly, and then, I click the login button, which issue a REST call to my PHP Backend (served by Apache/2.4.37 (Unix) PHP/7.2.14)

The package.json of my project didn't changed in quite some time. I've recently updated npm (6.9.0) & node (8.11.1), but it's not that recent.

 [12:14:13] Starting 'serve'...
[HPM] Proxy created: /rest  ->  http://localhost/
[12:14:13] Finished 'serve' after 49 ms
[BrowserSync SPA] Running...
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3000/
    External: http://192.168.1.21:3000/
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 --------------------------------------
[Browsersync] Serving files from: .tmp/serve
[Browsersync] Serving files from: src
[HPM] Error occurred while trying to proxy request /rest/authenticate from localhost:3000 to http://localhost/ (HPE_INVALID_CONSTANT) (https://nodejs.org/api/errors.html#errors_common_system_errors)
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at write_ (_http_outgoing.js:622:15)
    at ServerResponse.write (_http_outgoing.js:617:10)
    at IncomingMessage.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at IncomingMessage.emit (events.js:211:7)
    at IncomingMessage.Readable.read (_stream_readable.js:475:10)
    at flow (_stream_readable.js:846:34)
    at resume_ (_stream_readable.js:828:3)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Solution

  • In my php Backend, my configuration file was giving an empty "ReCaptcha" secret, which end up producing this crash on gulp/proxy... Can't understand why the error thrown by ReCaptcha can mess up the proxy so much...