Kong / insomnia

The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.
https://insomnia.rest
Apache License 2.0
34.84k stars 1.97k forks source link

Application Error importing Postman environment with unsupported characters in names #6179

Closed Terrance closed 4 months ago

Terrance commented 1 year ago

Expected Behavior

Imports complete successfully, substituting variable names if needed to conform to Insomnia's own variable name limitations.

Actual Behavior

Application Error

Failed to render. Please report to our Github issues Field names cannot contain a .

Reproduction Steps

  1. Go to Preferences > Data > Import
  2. Select Test.postman_environment.json (containing a single variable called Variable.Name) > Scan
  3. Confirm import of 1 environment > Import

Is there an existing issue for this?

Additional Information

Postman collections referencing invalid variable names are imported without any issues (the variables are just flagged as undefined, and of course I can't define variables matching those names as the environment editor blocks the use of .).

Insomnia Version

2023.5.0-beta.5

What operating system are you using?

Windows

Operating System Version

Windows 10 version 22H2 (OS Build 19045.3208)

Installation method

GitHub releases

Last Known Working Insomnia version

n/a (previous version ignored Postman collections: #6046)

rubencm commented 1 year ago

Same error here with Fedora Linux 38 (Workstation Edition). Insomnia version 2023.5.8 This is the stack trace of the error:

Error: Field names cannot contain a .
at checkKey (/snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/model.js:36:11)
at /snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/model.js:54:7
at Array.forEach (<anonymous>) at checkObject (/snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/model.js:53:22)
at /snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/model.js:55:7
at Array.forEach (<anonymous>) at Object.checkObject (/snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/model.js:53:22)
at Datastore.prepareDocumentForInsertion (/snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/datastore.js:388:11) 
at Datastore._insert (/snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/datastore.js:347:24)
at /snap/insomnia/226/resources/app.asar/node_modules/nedb/lib/executor.js:40:13

This seems a problem related with nedb https://github.com/louischatriot/nedb/issues/477

philippthiele commented 1 year ago

Anyone trying to import a postman collection: As a workaround replace variables you used, like e.g. for me "logger.name" in the exported collection json file with something supported using the search and replace function of the text editor of your choice, like e.g. "logger_name"

lcsmobileqa commented 1 year ago

Same error here. Insomnia version: 2023.5.8 OS: Windows OS Version: 11 Pro (22H2) Installation method: Github download link

priyankspot commented 11 months ago

this workaround worked for me as well.

ihexxa commented 4 months ago

Enabled validation for this case, closing this one and will be released in the next minor update.