Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ChainLink__factory, OneInchOracle__factory } from '../../contracts'
import { fiatDecimals, priceAdapterConfig } from './priceV2Config'

export const USD = 'USD'
const BASE_URL = 'https://price-api.metafi.codefi.network'
const BASE_URL = process.env.PRICE_API ?? 'https://price-api.metafi.codefi.network'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty env var bypasses fallback due to nullish coalescing

Medium Severity

Using ?? (nullish coalescing) instead of || means that if PRICE_API is set to an empty string (which some CI/Docker environments do), the fallback URL won't activate. An empty BASE_URL will then cause new URL(...) on line 112 to throw a TypeError: Invalid URL, and since that call sits outside the try/catch block, the error propagates unhandled from getSpotPriceByAddress.

Fix in Cursor Fix in Web


export interface SpotPrice {
allTimeHigh?: number
Expand Down
Loading