Roasting is pivotal for enhancing the flavor of Wuyi rock tea (WRT). A study investigated a novel compound that enhances the umami taste of WRT. Metabolomics of Shuixian tea (SXT) and Rougui tea (RGT) under light roasting (LR), medium roasting (MR), and heavy roasting (HR) revealed significant differences in nonvolatiles compounds. Compared LR reducing sugars and amino acids notably decreased in MR and HR, with l-alanine declining by 69%. Taste-guided fractionation identified fraction II-B as having high umami and sweet intensities. A surprising taste enhancer, N-(1-carboxyethyl)-6-(hydroxymethyl) pyridinium-3-ol (alapyridaine), was discovered and identified. It formed via the Maillard reaction, positively correlated with roasting in SXT and RGT. Alapyridaine levels were highest in SXT among the five oolong teas. Roasting tea with glucose increased alapyridaine levels, while EGCG inhibited its formation. HR-WRT exhibited enhanced umami and sweet taste, highlighting alapyridaine's impact on WRT's flavor profile. The formation of alapyridaine during the roasting process provides new insights into the umami and sweet perception of oolong tea.