duffelhq / duffel-api-javascript

JavaScript client library for the Duffel API

Home Page:https://duffel.com/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: url__WEBPACK_IMPORTED_MODULE_1__.URL is not a constructor

iamcharlesb opened this issue · comments

Hi Team,

I' am getting the below error, please help. BTW I love your product so much!

  const duffel = new Duffel({
    // Store your access token in an environment variable, keep it secret and only readable on your server
    token: 'My Token,
  });
  
  const offerRequestResponse = await duffel.offerRequests.create({
    slices : [
      {
        origin: "NYC",
        destination: "ATL",
        departure_date: "2022-06-21"
      },
      {
        origin: "ATL",
        destination: "NYC",
        departure_date: "2022-07-21"
      }
    ],
    passengers: [{ type: "adult" }, { type: "adult" }, { age: 1 }],
    cabin_class: "business",
    return_offers: true
  })
  
  console.log(offerRequestResponse.data.id);

Error which I' am receiving on my end

image

Hello @iamcharlesb and thanks for reporting the issue! Just a quick question, are you using the SDK on the client-side or server-side?

Will be closing the issue as there was no update in the last 29 days. If you have any other questions, please feel free to re-open the issue!

commented

I had the same issue.

I was using:
https://github.com/t3-oss/create-t3-turbo

But when I used the non turbo reop it worked:
https://github.com/t3-oss/create-t3-app

Not sure why.