Endoplasmic reticulum stress (ERS) is caused by the accumulation of intracellular misfolded or unfolded proteins and is associated with cancer development. In this study, pan-cancer analysis revealed complex genetic variations, including copy number variation, methylation, and somatic mutations for ERS-related genes (ERGs) in 33 kinds of cancer. Consensus clustering divided pancreatic cancer (PC) patients from TCGA and GEO databases into two ERS-related subtypes: ERGcluster A and B. Compared with ERGcluster A, ERGcluster B had a more active ERS state and worse prognosis. Subsequently, the ERS-related prognostic model was established to quantify the ERS score for a single sample. The patient with a low ERS score had remarkably longer survival times. ssGSEA and CIBERSORT algorithms revealed that activated B cells and CD8+ T cells had higher infiltration in the low ERS score group, but higher infiltration of activated CD4+ T cells, activated dendritic cells, macrophages, and neutrophils in the high ERS score group. Drug sensitivity analysis indicated the low ERS score group had a better response to gemcitabine, paclitaxel, 5-fluorouracil, oxaliplatin, and irinotecan. RT-qPCR validated that MET, MUC16, and KRT7 in the model had higher expression levels in pancreatic tumour tissues. Single-cell analysis further revealed that MET, MUC16, and KRT7 were mainly expressed in cancer cells in PC tumour microenvironment. In all, we first constructed the ERS-related molecular subtypes and prognostic model in PC. Our research highlighted the vital role of ERS in PC and contributed to further research on molecular mechanisms and novel therapeutic strategies for PC in the future.