Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script PostResponse: res is not a function #481

Open
gmajcen opened this issue Oct 9, 2023 · 10 comments · May be fixed by #579 or #3710
Open

script PostResponse: res is not a function #481

gmajcen opened this issue Oct 9, 2023 · 10 comments · May be fixed by #579 or #3710
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Community contribution is welcome module-scripting

Comments

@gmajcen
Copy link

gmajcen commented Oct 9, 2023

tried to save some ids to var in Post Response under scripts: const ids = res('features.id')

Error: Error invoking remote method 'send-http-request': TypeError: res is not a function

the same thing works with Vars.

@helloanoop
Copy link
Contributor

@gmajcen Yup, I am able to reproduce the bug. Will get this fixed.

Meanwhile, here is a workaround.

const {get} = require('lodash');

const page = get(res.getBody(), 'page');
console.log('page', page)

image

@helloanoop helloanoop added bug Something isn't working good first issue Good for newcomers help wanted Community contribution is welcome labels Oct 9, 2023
@armand-janssen
Copy link

I created #579 to fix it. It works on my machine 😄

@armand-janssen armand-janssen linked a pull request Oct 13, 2023 that will close this issue
@doliG
Copy link

doliG commented Nov 21, 2023

Hello, I have the same problem (v1.2.0). Any updates on this @helloanoop ?

It seems somewhat misleading from a user's perspective because the documentation explicitly states that the feature works but it does not. Tell me if I can do anything to help 😄

Note: the workaround mentionned works fine

@marshall-davis
Copy link

The res object doesn't seem to be created at all.

@angiurgiu
Copy link

angiurgiu commented Sep 5, 2024

The fix doesn't work, I am still getting 'Error invoking remote method 'send-http-request': TypeError: res is not a function' on the latest Bruno version.

@helloanoop
Copy link
Contributor

helloanoop commented Sep 6, 2024

@anusreesubash Please work with @sanjai0py and prioritise reviewing the PR #579

The res property should be a function which uses a custom query parser maintained by us - see https://docs.usebruno.com/scripting/response/response-query

@AcacioPN
Copy link

AcacioPN commented Dec 23, 2024

Any workarounds if res is not found at all? Or if not, anyone knows a version where this still worked?

@anusree-bruno
Copy link
Collaborator

@AcacioPN

Our team is working on this.
Are you not able to access the response data using the work around anoop had suggested in this comment #481 (comment)?

@AcacioPN
Copy link

Hi

Yes, the workaround worked. I might have been doing something wrong, as res was recognized sometimes, and other times it wasn't.

Bumping this because I'm a newbie with Bruno and it took me a few hours to suspect it might have been a bug, and 5+ different keyword searches in Google to find this bug, which is 1y old now and apparently has a tentative bugfix waiting for PR review for 1y as well - thought it might have been forgotten :)

I'll use the workaround happily!
Thanks!

@AcacioPN
Copy link

Replying to my previous comment: I found out what I was doing wrong. Turns out that the workaround doesn't work in Safe Mode -- only in Developer Mode was I able to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Community contribution is welcome module-scripting
Projects
None yet
9 participants