ProxymanApp / ProxymanApp/Proxyman

Invalid Promise object in Script runner breaks require of full lodash suite

Open
#1,420 14 comments 1 reaction 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Dec 17, 2023.

✅ Done bug
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Description

The Promise object in the Script runner does not support Promise.resolve.
The solution is either to remove the invalid Promise object or implement full support.
Uncomment the code in the example script below to watch it run correctly.

Steps to Reproduce

  1. Download the full package of lodash to user scripts location:
curl https://raw.githubusercontent.com/lodash/lodash/4.17.15-npm/lodash.min.js \
> ~/Library/Application\ Support/com.proxyman.NSProxy/users/lodash.min.js
  1. Create a script which uses lodash:
/*
    Uncomment the next line to make it work as a quick fix
*/
// delete(Promise);

const lodash = require("@users/lodash.min.js")
const object = { 'a': [{ 'b': { 'c': 3 } }] };
 
console.log(lodash.get(object, 'a[0].b.c'));
  1. Make a trigger and trigger it

Current Behavior

Lodash fails to load because Promise.resolve doesn't exist with error: "[...].resolve is not a function"

Expected Behavior

It should have executed and logged the value 3 to the console

Environment

  • App version: Version 3.12.0 (31200
  • macOS version: macOS Monterey

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.