rethinkdb / horizon

Horizon is a realtime, open-source backend for JavaScript apps.
MIT License
6.78k stars 349 forks source link

Uncaught Error: Operation not permitted. #845

Open vignestion opened 8 years ago

vignestion commented 8 years ago

Is this a bug or My mistake I don't know what's going on Just trying to add test values to database App.js

import React from 'react'; import Horizon from '@horizon/client'; const horizon = Horizon({authType: "unauthenticated"}); const test = horizon('test');

export default class Home extends React.Component{ componentDidMount(){ horizon.onReady(function () { console.log('iam') }); horizon.connect(); let message = { text: "What a beautiful horizon!", datetime: new Date(), author: "@dalanmiller" }; test.store(message)

}
render(){
    return(
        <div>
            This is Login
        </div>
    )
}

}

server.js

const express = require('express'); const https = require('https'); const path = require('path'); const fs = require('fs'); const horizon = require('@horizon/server');

const app = express();

// Serve our static stuff like css app.use(express.static(path.join(__dirname, 'dist')));

// Send all requests to index.html app.get('*', function (req, res) { res.sendFile(path.join(dirname, 'dist', 'index.html')); }); const options = { key: fs.readFileSync(path.resolve(dirname, './horizon-key.pem')), cert: fs.readFileSync(path.resolve(__dirname, './horizon-cert.pem')), };

const PORT = 8181;

const server = https.createServer(options, app);

server.listen(PORT, function() { console.log('Express server running at localhost:' + PORT); });

const horizon_options = { project_name: 'react_horizon', permissions: true,

auth: {
    token_secret:  'sd',
    allow_anonymous: true,
    allow_unauthenticated: true,

}

}; const horizon_server = horizon(server, horizon_options);

jirikolarik commented 8 years ago

Set permissions to false, then you don't have to care if operation is permitted or not