Lovable Troubleshooting

Common issues when building the Trusted Getaways booking app in Lovable, and the exact instruction to paste back into Lovable's chat to fix each one.

Connection & Setup

ProblemTell Lovable
No packages load, or server calls return 401Verify Lovable Cloud secrets are set: FD_API_KEY and FD_API_BASE_URL. Every server call must send the header x-api-key: Bearer <FD_API_KEY> and Accept: application/json. Never call the API from the browser.
Packages load in sandbox but fail in productionSwitch both values together: set FD_API_BASE_URL to https://holidays-volt-tp.travclan.com and FD_API_KEY to the production key, and set FD_ENV=production. Never mix a sandbox key with the production URL.
A destination shows no packagesCheck the destination_code in src/config/brand.ts is correct (see the FAQs). If the code is correct, the destination has no packages on sale; show the empty state, not an error.
"My Bookings" is empty after bookingThe server must save a row in bookings for every checkout, with the guest key hash of this browser. "My Bookings" reads only bookings made in the same browser; there is no sign-in.

Package Workflow & API Logic

ProblemTell Lovable
Package card shows the wrong price or dateFor each package, pick the earliest departure open for booking today (between booking_start_date and booking_end_date) with total_available > 0, and show its adult_price. If none qualifies, show the package as sold out.
All departure dates are listed on the pageShow only the selected departure in the booking box. List all departures only inside the departure picker pop-up, with closed or sold-out dates disabled.
Day-wise plan is missing hotels or flightsThe Day-wise Itinerary API has only transfers and activities. Add hotels from Package Details on their day_of_trip, after the transfer that drops at the hotel. Put the primary flight's outbound on Day 1 and its inbound on the last day; put other flights (e.g. inter-city flights) on their day_of_trip.
Return flight shows as emptyWhen a flight's inbound is null or has no segments, show only the outbound journey.
Day dates are wrongThe date of a day is the selected departure's travel_start_date + dayCount − 1. Recalculate the plan when the departure changes.

Pricing & Occupancy

ProblemTell Lovable
Total does not match the calculatorPrice each room on its own: 2+ adults pay their own prices; 1 adult alone pays single_adult_price; 1 adult with others pays the lower of Option A and Option B. Use the pricing module everywhere and run its unit tests.
Travellers picker allows invalid roomsEvery room needs an adult and must fit max_occupancy (DOUBLE = 2, TRIPLE = 3), with one extra infant allowed with 2+ adults. Total adults must be at least min_occupancy. Disable "Book now" and show the rule message until valid.
Book returns 409 "Prices have changed"Re-read the package with the Package Details API, recalculate the total, show the new price to the customer and ask them to confirm before booking again.

Add-ons & Upgrades

ProblemTell Lovable
Add-ons appear in a separate blockShow each add-on on its own day and item: hotel upgrades on the hotel card, transfer upgrades on the matching transfer card, "Start from another city" on the Day 1 flight, and optional activities on their day_of_trip.
Choosing an add-on does not update everythingKeep add-on choices in one store. The itinerary card, the "Staying at" rows, "Your extras", the total, Review and the booking request must all update together.
Add-on price is wrongAdd-ons are priced per traveller: adults × adult price + children × child price + infants × infant price. Hotel upgrades are priced room by room with the same rule as the package.
Hotel add-ons like "Sofa cum bed" can be addedHotel add-ons cannot be booked through the API. Show them as view-only, labelled "Request at the hotel", and never add them to the total.
Bottom sheet re-animates on every tapUpdate counts and choices in place. The sheet should animate only when it opens, never on state changes.

Did this page help you?