cainus / codecov.io

MIT License
44 stars 50 forks source link

Codecov API: invalid value for service using Circle CI #12

Closed edoparearyee closed 9 years ago

edoparearyee commented 9 years ago

I'm trying to simply use this library to post coverage from a private repo to codecov in CircleCI however the codecov api is returning a 400 when running cat ./coverage/lcov.info | ./node_modules/.bin/codecov. I've already generated the lcov data before trying to post to codecov. The API seems to be rejecting the request because the service name is not a valid value:

{ statusCode: 400,
     body: '{"meta": {"status": 400, "request": "7c537964-75a9-46f7-9f3c-3e12dfc598d8"}, "uploaded": false, "message": "Invalid value \'circle\' (str): must be ci-provider (at service)"}',
     request: 
      { url: 'https://codecov.io/upload/v2?service=circle&build=10&commit=COMMIT&branch=feature%2Fcodecov&pull_request=&owner=OWNER&repo=REPO&token=TOKEN&package=node',
        body: 'TN:\nSF:app/js/config/config.js\nFNF:0\nFNH:0\nDA:1,1\nLF:1\nLH:1\nBRF:0\nBRH:0\nend_of_record\nTN:\nSF:app/js/app.js\nFN:17,(anonymous_1)\nFNF:1\nFNH:0\nFNDA:0,(anonymous_1)\nDA:7,1\nDA:18,0\nLF:2\nLH:1\nBRF:0\nBRH:0\nend_of_record\n' } } } Error: non-success response
    at Request._callback (/home/ubuntu/REPO/node_modules/codecov.io/lib/sendToCodeCov.io.js:30:19)
    at Request.self.callback (/home/ubuntu/REPO/node_modules/codecov.io/node_modules/request/request.js:236:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/home/ubuntu/REPO/node_modules/codecov.io/node_modules/request/request.js:1142:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/ubuntu/REPO/node_modules/codecov.io/node_modules/request/request.js:1096:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:919:16
    at process._tickCallback (node.js:419:13)
detail:  { statusCode: 400,
  body: '{"meta": {"status": 400, "request": "7c537964-75a9-46f7-9f3c-3e12dfc598d8"}, "uploaded": false, "message": "Invalid value \'circle\' (str): must be ci-provider (at service)"}',
  request: 
   { url: 'https://codecov.io/upload/v2?service=circle&build=10&commit=COMMIT&branch=feature%2Fcodecov&pull_request=&owner=OWNER&repo=REPO&token=TOKEN&package=node',
     body: 'TN:\nSF:app/js/config/config.js\nFNF:0\nFNH:0\nDA:1,1\nLF:1\nLH:1\nBRF:0\nBRH:0\nend_of_record\nTN:\nSF:app/js/app.js\nFN:17,(anonymous_1)\nFNF:1\nFNH:0\nFNDA:0,(anonymous_1)\nDA:7,1\nDA:18,0\nLF:2\nLH:1\nBRF:0\nBRH:0\nend_of_record\n' } }

Could this simply be a configuration error with the service name being sent where the service name should be circleci instead of circle? I couldn't find any documentation on this in the codecov api docs.

Note I've replaced some of the values of the request as this is a private repo

stevepeak commented 9 years ago

@eopa thank you for bringing this to my attention. I'll be publishing this new version asap. Thanks!

edoparearyee commented 9 years ago

@stevepeak thanks for the quick response, that fixed it :grinning: