open-source-labs / obsidian Goto Github PK
View Code? Open in Web Editor NEWGraphQL, built for Deno - a native GraphQL caching client and server module
License: MIT License
GraphQL, built for Deno - a native GraphQL caching client and server module
License: MIT License
─ deno run --allow-env --allow-read server.ts ─╯
error: Uncaught (in promise) InvalidData: data did not match any variant of untagged enum ArgsEnum
throw new ErrorClass(res.err.message);
^
at processResponse (deno:core/core.js:213:11)
at Object.jsonOpAsync (deno:core/core.js:231:12)
at async Object.connect (deno:runtime/js/30_net.js:199:13)
at async RedisConnection.connectThunkified (https://raw.githubusercontent.com/keroxp/deno-redis/master/connection.ts:74:11)
at async RedisConnection.connect (https://raw.githubusercontent.com/keroxp/deno-redis/master/connection.ts:123:5)
at async connect (https://raw.githubusercontent.com/keroxp/deno-redis/master/redis.ts:2240:3) at async https://deno.land/x/[email protected]/src/CacheClassServer.js:10:11
If these branches do not have an active purpose, let's delete them
Delete normalize and DS_Fix.
https://github.com/open-source-labs/obsidian/tree/normalize
https://github.com/open-source-labs/obsidian/tree/DS_Fix
@TravisFrankMTG Are these still in use for release processes?
[expected]
only keep active branches for development
[actual]
normalize
Updated 14 months ago by TravisFrankMTG
DS_Fix
Updated 14 months ago by TravisFrankMTG
I have a simple app setup as follows:
import { importQL } from 'https://deno.land/x/importql/mod.ts';
import { Application } from 'https://deno.land/x/[email protected]/mod.ts';
import { Router } from 'https://deno.land/x/[email protected]/mod.ts';
import { ObsidianRouter } from 'https://deno.land/x/obsidian/mod.ts';
import { resolvers } from './resolvers.ts';
const types = importQL('schema.graphql');
const PORT = 1111;
const app = new Application();
const router = new Router();
interface ObsRouter extends Router {
obsidianSchema?: any;
}
const GraphQLRouter = await ObsidianRouter<ObsRouter>({
Router,
typeDefs: types,
resolvers: resolvers,
useCache: true,
usePlayground: true,
context: (request) => {
return {
...request,
secret: request?.request?.headers?.get('apiKey'),
ip: request?.request?.headers?.get('x-forwarded-for') || request?.request?.ip,
referer: request?.request?.headers?.get('referer'),
};
},
});
app.use(router.routes(), router.allowedMethods());
app.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());
await app.listen({
port: PORT,
});
When I run a simple query in my graphql playground such as
query getBook {
book(id:"1") {
id
}
}
I get an error Cannot read properties of undefined (reading 'indexOf')
. If I set useCache: false
then this error does not occur. Redis is running on the default port. Is there something wrong with my setup or is this a bug?
Hey!
I am the author of Pothos (https://pothos-graphql.dev/) and was just working on updating some outdated docs on building graphql APIs in deno. I was wondering if it would make sense to support obsidian as well, and describe how to get that set up in the pothos/deno docs.
It looks like currently it might be a little tricky because Obsidian only accepts typedefs/resolvers and builds an executable schema. Pothos generates a schema directly with resolvers already added to the GraphQL types. Would be great if we could just pass in a schema directly!
$ deno repl --eval 'import { gql } from "https://deno.land/x/[email protected]/mod.ts"'
error in --eval flag. Uncaught TypeError: Error parsing args: data did not match any variant of untagged enum ArgsEnum
at deno:core/01_core.js:101:46
at unwrapOpResult (deno:core/01_core.js:121:13)
at Object.opAsync (deno:core/01_core.js:130:28)
at opConnect (deno:ext/net/01_net.js:42:17)
at Object.connect (deno:ext/net/01_net.js:219:19)
at RedisConnection.connectThunkified (https://deno.land/x/[email protected]/connection.ts:74:22)
at RedisConnection.connect (https://deno.land/x/[email protected]/connection.ts:123:16)
at connect (https://deno.land/x/[email protected]/redis.ts:2275:20)
at https://deno.land/x/[email protected]/src/quickCache.js:12:17
Deno 1.14.3
exit using ctrl+d or close()
>
502 Bad Gateway at https://obsidian.land
Is there a way to use the obsidian client without needing react? I'm wanting to use it for an API client in a server-side application.
Hi everyone, thanks for the hard work! I'm having some trouble trying to run a simple API with the code provided on the Getting Started
section, I'll leave the details and my findings and please tell me if there's something I'm doing wrong.
First some specs:
OS: W10 with Ubuntu 20.04 (WSL)
Deno: v1.9.0
Obsidian: v3.0.0
Redis-server: v5.0.7
This is the code I have from the docs:
// server.tsx
import { Application, Router } from 'https://deno.land/x/[email protected]/mod.ts';
import { ObsidianRouter, gql } from 'https://deno.land/x/obsidian/mod.ts';
const PORT = 8000;
const app = new Application();
const types = (gql as any)`
type Movie {
id: ID
title: String
releaseYear: Int
}
type Query {
getMovie: Movie
}
`;
const resolvers = {
Query: {
getMovie: () => {
return {
id: "1",
title: "Up",
releaseYear: 2009
};
},
},
};
interface ObsRouter extends Router {
obsidianSchema?: any;
}
const GraphQLRouter = await ObsidianRouter<ObsRouter>({
Router,
typeDefs: types,
resolvers: resolvers,
useCache: false,
});
app.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());
app.addEventListener('listen', () => {
console.log(`Listening at http://localhost:${PORT}`);
});
await app.listen({ port: PORT });
And when I try to run with the flags that the CLI needed deno run --allow-net --allow-read --allow-env --unstable server.tsx
and also creating a .env
file with REDIS_HOST=6379
I'm getting this error:
error: Uncaught (in promise) TypeError: Invalid argument (os error 22)
: await Deno.connect(dialOpts);
^
at unwrapOpResult (deno:core/core.js:100:13)
at async Object.connect (deno:runtime/js/30_net.js:199:13)
at async RedisConnection.connectThunkified (https://deno.land/x/[email protected]/connection.ts:74:11)
at async RedisConnection.connect (https://deno.land/x/[email protected]/connection.ts:123:5)
at async connect (https://deno.land/x/[email protected]/redis.ts:2265:3)
at async https://deno.land/x/[email protected]/src/CacheClassServer.js:10:11
Doing some research seems like the os error 22
has something to do with sockets? And also I found that that line (: await Deno.connect(dialOpts)
is here on the redis repo https://deno.land/x/[email protected]/connection.ts#L74 and I don't know why it could be failing since I've tried to run this simple file to check if the redis server connection is alive and I'm seeing PONG
as a response:
import { connect } from "https://deno.land/x/redis/mod.ts";
const redis = await connect({
hostname: "127.0.0.1",
port: 6379
});
console.log(await redis.ping())
I guess I'm missing something since I don't know much about redis, hope someone can point me in the right direction
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.