Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

The 'path' argument must be of type string. Received type object #73

Closed
jhewitt opened this issue Nov 4, 2020 · 6 comments
Closed

The 'path' argument must be of type string. Received type object #73

jhewitt opened this issue Nov 4, 2020 · 6 comments

Comments

@jhewitt
Copy link

jhewitt commented Nov 4, 2020

Converting a multipart post script throws an ERR_INVALID_ARG_TYPE.

jhewitt@JimsMac LoadTest % postman-to-k6 PostmanCollection.json k6-script.js
The "path" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
    at validateString (internal/validators.js:125:11)
    at basename (path.js:1289:5)
    at fileLoad (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:190:16)
    at files (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:180:18)
    at render (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:20:5)
    at convertObject (/usr/local/lib/node_modules/postman-to-k6/lib/convert/object.js:45:10)
    at convertJson (/usr/local/lib/node_modules/postman-to-k6/lib/convert/json.js:26:10)
    at convertFile (/usr/local/lib/node_modules/postman-to-k6/lib/convert/file.js:31:10)
    at Command.run (/usr/local/lib/node_modules/postman-to-k6/bin/postman-to-k6.js:51:30)
    at Command.listener (/usr/local/lib/node_modules/postman-to-k6/node_modules/commander/index.js:315:8)

The postman script being converted is as follows:

{
	"info": {
		"_postman_id": "53810ff5-fa40-4971-9d83-9e0d7ef1f8a6",
		"name": "Quidel Load Testing",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Post Assay, Both Images - Flu A Positive",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "53f8e350-9de2-4cbb-9007-f16dc329e525",
						"exec": [
							"pm.test(\"Status Test\", () => {",
							"    pm.response.to.have.status(201);",
							"});"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"id": "8b675d75-b02a-4cab-99d8-1c1112620ca6",
						"exec": [
							"require('lodash');",
							"pm.environment.set(\"barcodeData\", Math.floor(_.random(10000000000000000000000000000000000000000000000, 99999999999999999999999999999999999999999999999)).toLocaleString('fullwide', {useGrouping: false}));"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "api-key",
						"value": "B051ED42-72C5-435A-B383-2D92346A9B6D",
						"type": "text"
					}
				],
				"body": {
					"mode": "formdata",
					"formdata": [
						{
							"key": "assayJson",
							"value": "{\n  assayJson : {\n    barcodeData: \"18382871446225358000000000000000000000000000000\",\n    barcodeType: 1,\n    userId: \"postman\",\n    appVersion: \"postman\",\n    phoneId: \"Postman\",\n    phoneOs: \"Postman\",\n    expirationDate: \"1/1/2020 12:00:00 AM\",\n    serialNumber: \"872930\",\n    auxBoxId: \"1234\",\n    assayType: \"90\",\n    testDate: \"1/1/2020 12:00:00 AM\",\n    results : [\n      {\n        type: \"fluBProb\",\n        value: \"0.85\"\n      },\n      {\n        type: \"fluAProb\",\n        value: \"0.75\"\n      },\n      {\n        type: \"rcPeakValue\",\n        value: \"100\"\n      },\n      {\n        type: \"fluAResult\",\n        value: \"positive\"\n      },\n      {\n          type: \"fluBResult\",\n          value: \"negative\"\n       }\n    ],\n    images : [\n      {\n        type: \"lightImage\",\n        fileName: \"18645_d1fd_DIMG_20201103T2218_5a8a345b-68b2-48f6-b537-74d084dc56c1.raw\",\n        captureTime: \"1/1/2020 12:00:00 AM\"\n      },\n      {\n        type: \"darkImage\",\n        fileName: \"18645_d1fd_LIMG_20201103T2218_4672fbab-048f-47b4-8698-4ae31ddf7551.raw\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate1\",\n        fileName: \"18645_d1fd_DBRGB_20201103T2218_0d3f5319-49a1-4bf5-b1ce-f6e1a75ac328.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate2\",\n        fileName: \"18645_d1fd_DBRD_20201103T2218_4146b8d3-7721-4497-9d21-4de3d3c5959a.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate3\",\n        fileName: \"18645_d1fd_NMRGB_20201103T2218_2e21a031-70cb-44a5-9811-992c2dbab6e9.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate4\",\n        fileName: \"18645_d1fd_RDCRP_20201103T2218_91be8f98-e335-432a-9c87-81cbd8cc045f.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate5\",\n        fileName: \"18645_d1fd_RGBCRP_20201103T2218_af5d97bf-99d9-4f95-b264-6f2ba4db8e3b.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      },\n      {\n        type: \"intermediate6\",\n        fileName: \"18645_d1fd_THBW_20201103T2218_3c660420-4af0-4604-b353-bc96ead36e3c.png\",\n        captureTime: \"1/1/2020 12:00:00AM\"\n      }\n    ]\n  }\n}",
							"contentType": "application/json",
							"type": "text"
						},
						{
							"key": "image[]\n",
							"type": "file",
							"src": [
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_DBRGB_20201103T2218_0d3f5319-49a1-4bf5-b1ce-f6e1a75ac328.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_DBRD_20201103T2218_4146b8d3-7721-4497-9d21-4de3d3c5959a.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_THBW_20201103T2218_3c660420-4af0-4604-b353-bc96ead36e3c.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_RGBCRP_20201103T2218_af5d97bf-99d9-4f95-b264-6f2ba4db8e3b.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_RDCRP_20201103T2218_91be8f98-e335-432a-9c87-81cbd8cc045f.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_NMRGB_20201103T2218_2e21a031-70cb-44a5-9811-992c2dbab6e9.png",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_LIMG_20201103T2218_4672fbab-048f-47b4-8698-4ae31ddf7551.raw",
								"/Users/jhewitt/Source/Quidel/LoadTest/18645_d1fd_DIMG_20201103T2218_5a8a345b-68b2-48f6-b537-74d084dc56c1.raw"
							]
						}
					],
					"options": {
						"formdata": {}
					}
				},
				"url": {
					"raw": "",
					"protocol": "https",
					"host": [
						"sniffles-api-dev",
						"azurewebsites",
						"net"
					],
					"path": [
						"api",
						"v1.0",
						"assay",
						"postassaywithimages"
					]
				}
			},
			"response": []
		}
	],
	"protocolProfileBehavior": {}
}
@dipeshlshah
Copy link

try postman-to-k6 PostmanCollection.json -o k6-script.js

@jhewitt
Copy link
Author

jhewitt commented Nov 5, 2020

It gives me the same error, I suspect it is erring on the key: image[] type: file src:[] in the body? The body of this working postman script is a multipart form with two key/value pairs, the first is a json message and the second is an array of image files being uploaded.

jhewitt@JimsMac loadtest % postman-to-k6 PostmanCollection.json -o k6-script.js
The "path" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
at validateString (internal/validators.js:125:11)
at basename (path.js:1289:5)
at fileLoad (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:190:16)
at files (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:180:18)
at render (/usr/local/lib/node_modules/postman-to-k6/lib/render/index.js:20:5)
at convertObject (/usr/local/lib/node_modules/postman-to-k6/lib/convert/object.js:45:10)
at convertJson (/usr/local/lib/node_modules/postman-to-k6/lib/convert/json.js:26:10)
at convertFile (/usr/local/lib/node_modules/postman-to-k6/lib/convert/file.js:31:10)
at Command.run (/usr/local/lib/node_modules/postman-to-k6/bin/postman-to-k6.js:51:30)
at Command.listener (/usr/local/lib/node_modules/postman-to-k6/node_modules/commander/index.js:315:8)

@simskij simskij self-assigned this Nov 20, 2020
@simskij
Copy link
Contributor

simskij commented Nov 20, 2020

Thank you for bringing this to my attention! Will have a look at it and get back to you.

@odetolataiwo
Copy link

is there any update on this yet?

@simskij
Copy link
Contributor

simskij commented Jun 11, 2021

Sorry, I've been completely swamped so not yet unfortunately. 😅

@simskij simskij removed their assignment Nov 12, 2021
@ppcano
Copy link
Collaborator

ppcano commented Nov 22, 2021

Apologies for the inactivity on this project.

Due to the inability to properly support this project, the k6 team has decided not to continue its development. The primary reason is that k6 scope has grown significantly with the launch of k6 extensions. The team is prioritizing extending k6 capabilities over the converters.

We suggest you post your issue at api-deck/postman-to-k6. The project is active and maintained on this fork.

@ppcano ppcano closed this as completed Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants