Http get not firing after successful barcode scan using async and await

I’m having trouble running an HttpClient GET function after a successful scan of a barcode. The barcode scanning is working but when I pass the barcode value to my get function nothing happens. I’m using async and await but must be missing something.

My HTTP GET function:

getOrderFromShopify(requestUrl: any) {
  
  this.http.get(requestUrl)
    .subscribe(data => {
      console.log(data);
      this.order_details = data["order"];
      this.line_items = data["order"]["line_items"];
    })
}

My Barcode Scan function:

async scanCode() {
    this.barcodeScanner
      .scan()
      .then(async barcodeData => {

        const baseURL = 'https://xxxxxxx.xxx?';
        const queryOptions = 'order_name=' + barcodeData.text; //Keep going
        let requestUrl = `${baseURL}${queryOptions}`;

        await this.getOrderFromShopify(requestUrl);

        this.scannedData = barcodeData;
      })
      .catch(err => {
        console.log("Error", err);
      });
  }

Add a console log on requestURl before the get

Try that url in the browser

Add error handler to the subscribe function

Add a timeout rxjs of 3secs

Some ideas to debug…

The await in await this.getOrderFromShopify(requestUrl); is pointless. The function does not return a promise. It returns nothing

$5 on this having nothing whatsoever to do with barcode scanners and await, but rather being garden-variety CORS misconfiguration.

No, not a CORS issue. I’ve tested using a function with a hard-coded URL using a button to trigger it without issue.

Added console log after requestUrl is set. It works.
console.log(“getOrderFromShopify Called:”); Works
console.log(data); Nothing. Empty log line

Try hardcording the url again as per your comment to the $5 bet and see if the get still works

If so, then you need to do a strict comparison of the url strings

Did you copy/paste the url argument in the browser, did that wirk?