postmanlabs / postmanlabs/postman-code-generators

Regression v1.3.0+ in Safari

Open
#681 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1k
Forks
381
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Using this package at ^1.3.0 results in the following exception in Safari:

Unhandled Promise Rejection: SyntaxError: Invalid regular expression: invalid group specifier named

This will crash any implementation that is not try/catching their usage around this library (e.g. when using the convert function).

To Reproduce
Steps to reproduce the behavior:

You can reproduce this issue by cloning this repository: https://github.com/cloud-annotations/docusaurus-openapi

  1. yarn install (note: the lock file is currently resolving 1.1.5)
  2. yarn build-packages
  3. yarn start
  4. In Safari, navigate to: http://localhost:3000/petstore
  5. Observe: The page loads, no errors in the console
  6. In Chrome, navigate to: http://localhost:3000/petstore
  7. Observe: The page loads, no errors in the console

Now, delete the yarn.lock file at the root of the repository and repeat the steps. (this will resolve 1.5.0)

  • In Safari, the page will not load and the following error will be displayed in the console:

Unhandled Promise Rejection: SyntaxError: Invalid regular expression: invalid group specifier named

  • In Chrome, the page will load and there is no error in the console.

Expected code snippet and corresponding request

N/A

Screenshots

N/A

Additional context

I tried to narrow which version was causing this issue and it appears to be in the v1.3.0 release era (happens in v1.4.0 and v1.5.0 as well).

It could be from this PR: https://github.com/postmanlabs/postman-code-generators/pull/651, however the changelog doesn't currently link to commits and is somewhat hard to narrow changes per release.

Safari does not support look behind with regular expression matching, so whatever change in v1.3.0 introduces that usage, is likely the culprit.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in the docusaurus-openapi example with yarn install, yarn build-packages, and yarn start, then compare the v1.1.5 lockfile result with v1.3.0–v1.5.0. Inspect the regular-expression changes associated with postman-code-generators PR 651 and the path reached by the convert function. Done means Safari loads without the exception while Chrome behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.