The invention is directed to a waterproof endoscope having a wafer-level imaging module (WLM) bonded on a substrate. The endoscope also includes a holder, which has a groove formed into an inner surface of the holder. First glue is filled in the groove, and second glue is applied at a junction between the holder and the tube.