Error in creating scene object

1. A concise explanation of the problem you're experiencing.

I am running the following code. when scene object is created using the canvas, following error occurs

Cesium.js:159461 Uncaught TypeError: canvas.getContext is not a function
at new Context (Cesium.js:159461)
at new Scene (Cesium.js:205696)
at cesium5.html:28

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

    var viewer = new Cesium.Viewer('cesiumContainer');
    var canvas = document.getElementById('cesiumContainer');
    var scene = new Cesium.Scene({
      canvas : canvas,
      contextOptions : {
        allowTextureFilterAnisotropic : false
    var primitives = scene.primitives;
    var globe = new Cesium.Globe(Cesium.Ellipsoid.WGS84);

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I need to display my terrain data using geoserverterrainprovider

4. The Cesium version you're using, your operating system and browser.

My cesium version is 1.38

Hi there,

Don’t create the scene directly, try creating the the viewer with Cesium.Viewer. You can then access the scene with Viewer.scene. Check out the Terrain Sandcastle Example for an example of creating the Viewer and adding terrain.