You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I may be wrong, but I'm expecting to be able to use almost any other JavaScript feature inside those EJS files.
As a side note, I'm not entire sure why the same output appears on the logs multiple times. I would assume it's getting read/parsed multiple times, but it could be also that the log statements are just getting repeated.
Software Versions Used
OS : Arch Linux
mountebank : 2.6.0
Installation method : Docker
Log contents in mb.log when running mb --loglevel debug
$ docker logs --follow mountebank
warn: [mb:2525] Running with --allowInjection set. See http://localhost:2525/docs/security for security info
info: [mb:2525] mountebank v2.6.0 now taking orders - point your browser to http://localhost:2525/ forhelp
debug: [mb:2525] config: {"options":{"allowInjection":true,"allow-injection":true,"configfile":"/app/config/imposters.ejs","port":2525,"noParse":false,"no-parse":false,"formatter":"mountebank-formatters","pidfile":"mb.pid","localOnly":false,"local-only":false,"ipWhitelist":["*"],"ip-whitelist":"*","mock":false,"debug":false,"heroku":false,"protofile":"protocols.json","origin":false,"log":{"level":"debug","transports":{"console":{"colorize":true,"format":"%level: %message"},"file":{"path":"mb.log","format":"json"}}}},"process":{"nodeVersion":"v14.19.0","architecture":"x64","platform":"linux"}}
info: [mb:2525] PUT /imposters
debug: [mb:2525] ::ffff:127.0.0.1:59146 => {"imposters":[{"name":"characters-api.imposter","port":8081,"protocol":"http","stubs":[{"predicates":[{"equals":{"headers":{"Accept":"application/json"},"method":"GET"},"matches":{"path":"/api/characters/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"}}],"responses":[{"inject":"(request, state, logger, callback) => {\n const age = parseInt(\"${character}[age]\");\n logger.debug(`==> age = ${age}`);\n const response = {\n body: {\n \"first_name\": \"${character}[first_name]\",\n \"last_name\": \"${character}[last_name]\",\n \"age\": age,\n \"_id\": \"${character}[character_id]\"\n },\n headers: {\n \"Content-Type\": \"application/json\"\n },\n statusCode: 200\n };\n\n return response;\n}","behaviors":[{"lookup":{"fromDataSource":{"csv":{"delimiter":",","keyColumn":"character_id","path":"config/characters-api/characters.dataset.csv"}},"into":"${character}","key":{"from":"path","index":1,"using":{"method":"regex","selector":"/api/characters/(.*)$"}}}}]}]},{"predicates":[{"equals":{"headers":{"Accept":"application/json","Content-Type":"application/json"},"method":"POST","path":"/api/characters"}}],"responses":[{"inject":"(request, state, logger, callback) => {\n const crypto = require(\"crypto\");\n const response = {\n headers: {\n \"Location\": `${request.path}/${crypto.randomUUID()}`\n },\n statusCode: 201\n };\n\n return response;\n}"}]}]}]}
info: [http:8081 characters-api.imposter] Open for business...
(node:1) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open 'mb.pid'
at Object.openSync (fs.js:497:3)
at Object.writeFileSync (fs.js:1528:35)
at Object.start (/usr/local/lib/node_modules/mountebank/bin/mb:53:12)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async functionwithout 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)
(node:1) [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.
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35172 ESTABLISHED
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 ESTABLISHED
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35172 LAST-ACK
info: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 => GET /api/characters/baf5dade-eabd-4d54-98f7-e90f6953108f
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 => {"requestFrom":"::ffff:172.22.0.1:35180","method":"GET","path":"/api/characters/baf5dade-eabd-4d54-98f7-e90f6953108f","query":{},"headers":{"Accept":"application/json","User-Agent":"PostmanRuntime/7.29.2","Host":"localhost:8081","Accept-Encoding":"gzip, deflate, br","Connection":"keep-alive"},"body":"","ip":"::ffff:172.22.0.1"}
debug: [http:8081 characters-api.imposter] using predicate match: [{"equals":{"headers":{"Accept":"application/json"},"method":"GET"},"matches":{"path":"/api/characters/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"}}]
debug: [http:8081 characters-api.imposter] generating response from {"inject":"(request, state, logger, callback) => {\n const age = parseInt(\"${character}[age]\");\n logger.debug(`==> age = ${age}`);\n const response = {\n body: {\n \"first_name\": \"${character}[first_name]\",\n \"last_name\": \"${character}[last_name]\",\n \"age\": age,\n \"_id\": \"${character}[character_id]\"\n },\n headers: {\n \"Content-Type\": \"application/json\"\n },\n statusCode: 200\n };\n\n return response;\n}","behaviors":[{"lookup":{"fromDataSource":{"csv":{"delimiter":",","keyColumn":"character_id","path":"config/characters-api/characters.dataset.csv"}},"into":"${character}","key":{"from":"path","index":1,"using":{"method":"regex","selector":"/api/characters/(.*)$"}}}}]}
debug: [http:8081 characters-api.imposter] ==> age = NaN
debug: [http:8081 characters-api.imposter] using stub response behavior [{"lookup":{"fromDataSource":{"csv":{"delimiter":",","keyColumn":"character_id","path":"config/characters-api/characters.dataset.csv"}},"into":"${character}","key":{"from":"path","index":1,"using":{"method":"regex","selector":"/api/characters/(.*)$"}}}}]
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35172 CLOSED
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"character_id\"]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}['character_id']" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[character_id]" with "baf5dade-eabd-4d54-98f7-e90f6953108f"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"first_name\"]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}['first_name']" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[first_name]" with "Guybrush"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"last_name\"]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}['last_name']" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[last_name]" with "Threepwood"
debug: [http:8081 characters-api.imposter] Replacing "${character}[\"age\"]" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}['age']" with "38"
debug: [http:8081 characters-api.imposter] Replacing "${character}[age]" with "38"
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 <= {"statusCode":200,"headers":{"Content-Type":"application/json","Connection":"close"},"body":"{\n \"first_name\": \"Guybrush\",\n \"last_name\": \"Threepwood\",\n \"age\": null,\n \"_id\": \"baf5dade-eabd-4d54-98f7-e90f6953108f\"\n}","_mode":"text"}
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 LAST-ACK
debug: [http:8081 characters-api.imposter] ::ffff:172.22.0.1:35180 CLOSED
The text was updated successfully, but these errors were encountered:
Expected Behaviour
Actual Behaviour
Steps to Reproduce
Define some stub like:
I may be wrong, but I'm expecting to be able to use almost any other JavaScript feature inside those EJS files.
Software Versions Used
Log contents in mb.log when running mb --loglevel debug
The text was updated successfully, but these errors were encountered: