Cancer cells that migrate from tumors into surrounding tissues are responsible for cancer dissemination through the body. Microfluidic devices have been instrumental in discovering unexpected features of cancer cell migration, including the migration in self-generated gradients and the contributions of cell-cell contact during collective migration. Here, we design microfluidic channels with five successive bifurcations to characterize the directionality of cancer cell migration with high precision. We find that the directional decisions of cancer cells moving through bifurcating channels in response to self-generated epidermal growth factor (EGF) gradients require the presence of glutamine in the culture media. A biophysical model helps quantify the contribution of glucose and glutamine to cancer cell orientation during migration in self-generated gradients. Our study uncovers an unexpected interplay between cancer cell metabolism and cancer cell migration studies and may eventually lead to new ways to delay cancer cell invasion.