k6

TypeError: Object has no member 'replace'

Hi

I’ve just converted a postman collection through postman-to-k6 tool.

I’m having the current problem when executing the script and it seems to be connected to http.file part

I’m out of clues about what is happening here

code:

export default function() {
		
  postman[Request]({
    name: "/recommendation (file upload)",
    id: "72996999-1924-45d4-8b65-1e1867785397",
    method: "POST",
    address: "{{recommendation-url}}/recommendation?start=1&limit=10",
    data: { user_id: "5", file: http.file(document_file) },
    headers: {
      "Content-Type": "application/json"
    },
    post(response) {
      var jsonData = JSON.parse(responseBody);
      postman.setEnvironmentVariable(
        "recommendation_request.id",
        jsonData.recommendation_request.id
      );
    }
  });

Error raised while running the script:

ERRO[0005] TypeError: Object has no member 'replace'
        at makeRequestConfig (file:///C:/Users/marcelodalmeida/Desktop/entulho/B-Finder/libs/shim/core.js:996:205(117))
        at executeRequest (file:///C:/Users/marcelodalmeida/Desktop/entulho/B-Finder/libs/shim/core.js:960:35(78))
        at executeRequest (file:///C:/Users/marcelodalmeida/Desktop/entulho/B-Finder/libs/shim/core.js:956:234(53))
        at file:///C:/Users/marcelodalmeida/Desktop/entulho/B-Finder/libs/shim/core.js:307:46(35)
        at file:///C:/Users/marcelodalmeida/Desktop/entulho/B-Finder/recommendation-k6-script.js:37:19(31)
    done [==========================================================] 1 / 1

Thank you in advance

Hi,

this looks like a bug in postman-to-k6. It doesn’t seem to handle k6’s FileData object properly, as it expects all data values to be strings.

Could you please create a new issue at https://github.com/loadimpact/postman-to-k6/issues ?

Thanks,

Ivan

Sure.

I’m doing it now

Thank you