eXist-db / templating

HTML Templating Library for eXist-db
GNU Lesser General Public License v2.1
5 stars 8 forks source link

[BUG] npm test "Error in plugin gulp-exist" during installLibraryXar #11

Closed joewiz closed 2 years ago

joewiz commented 2 years ago

Expected behavior

Previously, npm test worked perfectly - building and installing the package and running tests - as follows:

% npm test

> templating@1.0.3 test
> gulp install:all && mocha test/mocha --recursive --exit

[23:31:43] Using gulpfile ~/workspace/templating/gulpfile.js
[23:31:43] Starting 'install:all'...
[23:31:43] Starting 'cleanAll'...
[23:31:43] Finished 'cleanAll' after 2.95 ms
[23:31:43] Starting 'templates'...
[23:31:43] Finished 'templates' after 23 ms
[23:31:43] Starting 'copyStatic'...
[23:31:43] Finished 'copyStatic' after 4.51 ms
[23:31:43] Starting 'xar'...
[23:31:43] Finished 'xar' after 14 ms
[23:31:43] Starting 'installLibraryXar'...
[23:31:43] Uploading templating-1.0.3.xar (9135 bytes)
[23:31:43] Install http://exist-db.org/html-templating from templating-1.0.3.xar
[23:31:43] Application was updated
[23:31:43] Finished 'installLibraryXar' after 61 ms
[23:31:43] Starting 'packageTestApp'...
[23:31:43] Finished 'packageTestApp' after 16 ms
[23:31:43] Starting 'installTestAppXar'...
[23:31:43] Uploading test-templating.xar (5541 bytes)
[23:31:43] Install http://exist-db.org/html-templating-test from test-templating.xar
[23:31:43] Application was updated
[23:31:43] Finished 'installTestAppXar' after 161 ms
[23:31:43] Finished 'install:all' after 284 ms

  file system checks
    markup files are well-formed
      ✓ *.html is xhtml
      ✓ *.xml
      ✓ *.xconf
      ✓ *.odd

  expand HTML template
    ✓ handles default and static parameters (132ms)
    ✓ request parameter overwrites static default
    ✓ converts parameter types
    ✓ rejects wrong parameter type
    ✓ reports missing template functions

  Supports template nesting
    ✓ handles nested templates

  Supports form fields
    ✓ injects form field values

  Supports set and unset param
    ✓ supports set and unset with multiple params of the same name

  Supports parsing parameters
    ✓ supports parsing parameters in attributes and text
    ✓ supports expanding from model
    ✓ fails gracefully
    ✓ serializes maps and arrays to JSON
    ✓ handles different delimiters

  Fail if template is missing
    ✓ fails if template could not be found

  Supports including another file
    ✓ replaces target blocks in included file

  Supports resolving app location
    ✓ replaces variable with app URL (57ms)

  20 passing (430ms)

Actual behavior

Now, after running npm update, npm test fails with an Error in plugin "gulp-exist" error:

% npm test  

> templating@1.0.3 test
> gulp install:all && mocha test/mocha --recursive --exit

[23:46:57] Using gulpfile ~/workspace/templating/gulpfile.js
[23:46:57] Starting 'install:all'...
[23:46:57] Starting 'cleanAll'...
[23:46:57] Finished 'cleanAll' after 2.98 ms
[23:46:57] Starting 'templates'...
[23:46:57] Finished 'templates' after 23 ms
[23:46:57] Starting 'copyStatic'...
[23:46:57] Finished 'copyStatic' after 4.68 ms
[23:46:57] Starting 'xar'...
[23:46:57] Finished 'xar' after 14 ms
[23:46:57] Starting 'installLibraryXar'...
[23:46:57] Uploading templating-1.0.3.xar (9135 bytes)
[23:46:57] 'installLibraryXar' errored after 17 ms
[23:46:57] Error in plugin "gulp-exist"
Message:
    XAR was not uploaded
Details:
    domainEmitter: [object Object]
    domainThrown: false

[23:46:57] 'install:all' errored after 64 ms

Reproduction steps

Make a fresh clone of templating and run npm test, or in an existing clone of templating, run npm update, then npm test.

If you change package.json to require gulp-exist "4.0.0" instead of "^4.0.0", the error goes away.

This suggests some sort of regression in gulp-exist >4.0.0.

Please provide the following

line-o commented 2 years ago

Which version of gulp-exist was installed with the 4.0.0 version declaration

line-o commented 2 years ago

I can reproduce the error. And it is a bug in gulp-exist (interestingly it is not in the current version node-exist). Affected version are 4.2.0 and 4.3.0 (latest).

line-o commented 2 years ago

I debugged it and the call to existdb fails with

EPROTO 4483317184:error:1408F10B:SSL routines:ssl3_get_record:wrong version number

This is because gulp-exist (since 4.2.0) uses an HTTPS connection by default. And this seems to fail.

line-o commented 2 years ago

Yeah the configuration in .existdb.json does use HTTP and this requires the secure flag to be set to false in the connection options in the gulpfile.js

line-o commented 2 years ago

Should we use the newly introduced function readOptionsfromEnv?