Failed assertion ctx.createPattern(img, 'repeat') === null (got [object CanvasPattern][object], expected [object])