HoudiniGraphql / houdini

The disappearing GraphQL client

Home Page:http://www.houdinigraphql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I need more information on Errors

LazerJesus opened this issue Β· comments

commented

Describe the bug

Somewhere in my schema is an error. But the debugging info Houdini provides doesnt help me find where.

This is the error message i get on build and then it fails:

🎩 Generating runtime...
❌ undefined does not match field "name": string of type Identifier
error when starting dev server:
Error: undefined does not match field "name": string of type Identifier
[[...]]
error: script "dev" exited with code 1 (SIGHUP)

how can i get information like Object or File?

Severity

blocking all usage of Houdini

Reproduce

  1. have a schema error
  2. start a vite dev server
commented

You have 0 operation defined?
Could you send the schema so that we can replicate and find a way to describe better the error?

commented

hi @jycouet
what is 0 operation?
I need more information for debugging in general.
this is not the entire schema but the only occurence of name.

type Query {
  curriculumsRead: [Curriculum!]!
}

type Curriculum {
  id: ID!
  name: String!
}

EDIT:

this is the entire error message:

Error: undefined does not match field "name": string of type Identifier
    at addParam (file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:31704:21)
    at file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:31720:17
    at Array.forEach (<anonymous>)
    at Object.builder [as identifier] (file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:31718:31)
    at scalarPropertyValue (file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:74312:42)
    at file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:75314:19
    at Array.map (<anonymous>)
    at file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:75308:44
    at Array.map (<anonymous>)
    at typeDefinitions (file:///Users/finn/vivalence/code/spanish/app/frontend/node_modules/houdini/build/vite-esm/index.js:75282:13)
error: script "dev" exited with code 1 (SIGHUP)

i get NO Information about the file or line where this error occurs or anythin of the sort that would help me identify where even to look.

commented

removing houdini from the vite plugins allows the server to start.

 defineConfig({
    plugins: [sveltekit()]
})
commented

What I mean by 0 Operation is to know if you have already some queries or mutations in your frontend?

With this small schema, you have the same error? Or only when you have the complete schema?
(You can comment watchSchema to not overwrite your schema.graphql)

Could you share the complete schema for me to check as well?

commented

I was able to isolate the Object causing the issue by comment-toggling all types and resolvers.
but i dont want to have to resolve to that level of manual labor just to get information on the source of the issue.
all that labor would have been saved if 1. i had the name of the object or 2. the file and line in the error message undefined does not match field "name"
how can i enable that if thats possable? if not then how do other deal with this?

commented

If I understand correctly, it was a Server / GraphQL Schema issue, correct?
To be able to help with a better message, we have to reproduce 'the error' in our e2e test and it will help everyone πŸ‘.

Our messages today are more focused on the client side of it. We assume that your server is πŸ‘

Let's try to improve that! Can you share the bit that was causing the issue?

commented

the issue was on the front end.
the server is type checked and was building fine without any conflicts, misses, or inconsistencies. I am using pothos-graphql.
as you can see in the error logs i posted, there was no information about the client side location of the error.

commented

Okay, I apologize 😒

Can you show the query you were doing so that we reproduce in the e2e tests?

Thx!

commented

i'd love to but i've solved the issue yesterday and that particular state wasn't gited. if it happens again, i will.
but my problem was the lack of information about the issue, not this specific issue.

commented

Yes!
But I need more info about your issue, because usually errors look like this:
Capture d’écran 2023-11-22 aΜ€ 09 46 57

Where you see the filePath, the field, the type... Everything! πŸŽ‰

So why not in your case? I would like to understand your case to do things better πŸ˜‰.

commented

ok yeah thats what i need. ok then lets go from the ground up.

package.json

{
    "name": "frontend",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "dev": "vite --force dev",
        "build": "vite build",
        "preview": "vite preview",
        "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
        "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
        "lint": "prettier --plugin-search-dir . --check . && eslint .",
        "format": "prettier --plugin-search-dir . --write .",
        "storybook": "storybook dev -p 6006",
        "build-storybook": "storybook build"
    },
    "devDependencies": {
        "@storybook/addon-docs": "^7.5.2",
        "@storybook/addon-essentials": "^7.5.2",
        "@storybook/addon-interactions": "^7.5.2",
        "@storybook/addon-links": "^7.5.2",
        "@storybook/addon-svelte-csf": "^4.0.9",
        "@storybook/blocks": "^7.5.2",
        "@storybook/builder-vite": "^7.5.2",
        "@storybook/svelte": "^7.5.2",
        "@storybook/sveltekit": "^7.5.2",
        "@storybook/testing-library": "^0.2.2",
        "@sveltejs/adapter-auto": "^2.0.0",
        "@sveltejs/adapter-node": "^1.3.1",
        "@sveltejs/kit": "^1.20.4",
        "autoprefixer": "^10.4.14",
        "eslint": "^8.28.0",
        "eslint-config-prettier": "^8.5.0",
        "eslint-plugin-storybook": "^0.6.15",
        "eslint-plugin-svelte": "^2.30.0",
        "houdini": "^1.2.10",
        "houdini-svelte": "^1.2.10",
        "postcss": "^8.4.24",
        "postcss-load-config": "^4.0.1",
        "prettier": "latest",
        "prettier-plugin-svelte": "latest",
        "storybook": "^7.5.2",
        "svelte": "^4.0.5",
        "svelte-check": "^3.4.3",
        "svelte-preprocess": "^5.0.4",
        "tailwindcss": "^3.3.2",
        "typescript": "^5.0.0",
        "@storybook/addon-actions": "^7.5.2",
        "vite": "^4.4.9"
    },
    "type": "module",
    "dependencies": {
        "graphql-scalars": "^1.22.4",
        "svelte-swipe": "^2.0.3"
    }
}

viteconfig

import { defineConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";
import houdini from "houdini/vite";

export default defineConfig({
    plugins: [houdini(), sveltekit()],
    logLevel: "info",
    mode: "development"
});

svelte config

import { vitePreprocess } from "@sveltejs/kit/vite";
import preprocess from "svelte-preprocess";

import adapter from "@sveltejs/adapter-node";

/** @type {import('@sveltejs/kit').Config} */
const config = {
    kit: {
        adapter: adapter(),
        alias: {
            $houdini: "./$houdini"
        }
    },

    preprocess: [
        vitePreprocess({})
        // preprocess({
        //   postcss: true
        // })
    ]
};

export default config;

houdini.js

import { DateTimeResolver, DateTimeMock } from "graphql-scalars";
/// <references types="houdini-svelte">

/** @type {import('houdini').ConfigFile} */
const config = {
    watchSchema: {
        url: "http://localhost:4000"
    },
    plugins: {
        "houdini-svelte": {}
    },
    scalars: {
        DateTime: DateTimeResolver
    }
};

export default config;

I'll try setting up the project in a way that it reproduces the error.

commented

ok so, just introducing a faulty gql string results in your verbose error. i search.

I'm going to close this since its gone a bit stale. Let me know if you are still running into issues and we can reopen this if you run into something reproducible that we can try