Having issues with sockets in Lua

Having issues calling socket connect looks like my create socket call is working but when i try to socket connect its a nil value? Any advice / help would be greatly appreciated.

local nakama = require "nakama.nakama"
local log = require "nakama.util.log"
local retries = require "nakama.util.retries"
local defold = require "nakama.engine.defold"
local nakama_session = require "nakama.session"


local function authenticate_with_device(client)
    nakama.sync(function()
        local vars = nil
        local create = true
        local result = nakama.authenticate_device(client, defold.uuid(), vars, create, "yack28")

        if not result.token then
            print("Unable to login")
            return
        end

        -- store the token to use when communicating with the server
        nakama.set_bearer_token(client, result.token)
    
        
        -- store the token on disk
        local d = result
        local session = nakama_session.create(d)
        print(session.user_id)
    
    end)
end

function init(self)
    msg.post(".", "acquire_input_focus")
    log.print()

    local config = {
        host = "127.0.0.1",
        port = 7350,
        use_ssl = false,
        username = "defaultkey",
        password = "",
        engine = defold,
    }

    local client = nakama.create_client(config)

    authenticate_with_device(client)

    local socket = nakama.create_socket(client)

    print(socket)

    nakama.sync(function()
        -- connect
        local ok, err = nakama.socket_connect(socket)

        if ok then
            print("yes")
        end

        if err then
            print(err.message)
        end
    end)
end

    
DEBUG:SCRIPT: HTTP    POST    http://127.0.0.1:7350/v2/account/authenticate/device?username=yack30&create=true
DEBUG:SCRIPT: table: 0x025b553e39a0
DEBUG:SCRIPT: main/serverauth.script:54: attempt to call field 'socket_connect' (a nil value)
DEBUG:SCRIPT: vmath.quat(0, 0, 0, 1)
Registered luasec Extension
Account creation working just hid the keys / calls