Console.log in pre request script is not showing in async

console.log() in pre request script is not showing in the postman console

I create a collection with a pre-request script below

console.log('test1')


(async function main() {
    console.log('test2')
})();

And we create a request in this collection and send a request.

There is a error show below

TypeError: console.log(...) is not a function

Version 10.18.9
UI Version: 10.18.9-ui-230926-0710
Desktop Platform Version: 10.18.7 (10.18.7)

Hey @telecoms-physicist11 :wave:

Welcome to the Postman Community! :postman:

Without further context about how your using that statement (I can think of a lot) or any kind of visual examples to show what you’re seeing on your side - It’s going to be extremely difficult for anyone to help you here.

Please use this topic as a guide on how to best ask questions on the forum.

@danny-dainton Thanks for reminder. I updated my question

You are missing the semi colon at the end of the first console log to terminate that command.

console.log('test1');

(async function main() {
    console.log('test2')
})();

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.