Having an error with finalize()
See original GitHub issueI’m using “pact”: “2.2.1” and today I found same code failed with newly npm install.
{"message":"Error ocurred in mock service: NoMethodError - undefined method `each' for #<String:0x2b913e8>","backtrace":["C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/request_decorator.rb:40:in `query'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/request_decorator.rb:20:in `as_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/interaction_decorator.rb:18:in `as_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_decorator.rb:18:in `block in as_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_decorator.rb:18:in `collect'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_decorator.rb:18:in `as_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_decorator.rb:26:in `to_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/json-2.0.3/lib/json/pure/generator.rb:242:in `generate'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/json-2.0.3/lib/json/common.rb:286:in `pretty_generate'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_writer.rb:66:in `pact_json'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_writer.rb:59:in `update_pactfile'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_writer.rb:52:in `update_pactfile_if_needed'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer_contract/consumer_contract_writer.rb:37:in `write'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/mock_service/request_handlers/pact_post.rb:31:in `respond'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/mock_service/request_handlers/base_request_handler.rb:17:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/rack-2.0.1/lib/rack/cascade.rb:33:in `block in call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/rack-2.0.1/lib/rack/cascade.rb:24:in `each'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/rack-2.0.1/lib/rack/cascade.rb:24:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer/mock_service/cors_origin_header_middleware.rb:11:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer/mock_service/error_handler.rb:13:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/mock_service/app.rb:32:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/app/lib/pact/consumer/mock_service/set_location.rb:14:in `call'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/rack-2.0.1/lib/rack/handler/webrick.rb:86:in `service'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:138:in `service'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:94:in `run'","C:/Projects/ei-site-api-debug/ei-site-api/src/node_modules/@pact-foundation/pact-mock-service-win32/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'
This error was introduced between 3 days ago to today. I compared the \node_modules@pact-foundation\pact-node\package.json in two copies and find difference:
"@pact-foundation/pact-mock-service": "0.10.x",
"@pact-foundation/pact-provider-verifier": "0.1.x",
"@pact-foundation/pact-mock-service": "1.x.x",
"@pact-foundation/pact-provider-verifier": "1.x.x",
Having the same issue with pact version “pact”: “2.3.4” Could anyone please help have a look?
Issue Analytics
- State:
- Created 6 years ago
- Comments:27 (14 by maintainers)
Top Results From Across the Web
How can I know if Observable has finalized with error or ...
pipe(finalize(() => { //here }));. As you see, I'm using finalize operator, but I can't know if has finalized with or without error....
Read more >Finalize Operator | Error Handling - RxJS Course
The finalize() operator accepts a callback function that will be invoked upon the source Observable emitting an error or completion notification, ...
Read more >finalize - RxJS
Returns an Observable that mirrors the source Observable, but will call a specified function when the source terminates on complete or error.
Read more >Having an error with finalize() · Issue #34 · pact-foundation ...
I'm using "pact": "2.2.1" and today I found same code failed with newly npm install. {"message":"Error ocurred in mock service: ...
Read more >RxJS finalize operator to execute logic on Observable ...
An RxJS operator for executing logic when the Observable terminates ... In this article we're going to have a look at the RxJS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After upgrading the pact version to “2.4.2”, it looks fine in my project. Thanks for the fix @mefellows
It seems that both the map and string versions of the query is now supported so that solves my problem for now. I gather from reading the issue that the specification version syntax in the pact metadata is still to be decided and implemented in pact-jvm (and possibly elsewhere)? It doesn’t hurt me right now though. Thanks for the quick action @mefellows & @bethesque!