firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 933 forks source link

DataConnect connection fails with 'No schema found for service' error when retrieving data #7828

Open 1amageek opened 4 days ago

1amageek commented 4 days ago

[REQUIRED] Environment info

firebase-tools:13.22.0

Platform:macOS

[REQUIRED] Steps to reproduce

  1. Define the schema and queries for DataConnect.
  2. Generate the SDK.
  3. Run the application in Next.js.

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://127.0.0.1:4040/               │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┬──────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI              │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4040/auth       │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Functions      │ 127.0.0.1:5001 │ http://127.0.0.1:4040/functions  │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Firestore      │ 127.0.0.1:8080 │ http://127.0.0.1:4040/firestore  │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Hosting        │ 127.0.0.1:5002 │ n/a                              │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Storage        │ 127.0.0.1:9199 │ http://127.0.0.1:4040/storage    │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Data Connect   │ 127.0.0.1:9399 │ n/a                              │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Extensions     │ 127.0.0.1:5001 │ http://127.0.0.1:4040/extensions │
└────────────────┴────────────────┴──────────────────────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500, 9150
┌─────────────────────────┬───────────────┬─────────────────────┐
│ Extension Instance Name │ Extension Ref │ View in Emulator UI │
└─────────────────────────┴───────────────┴─────────────────────┘
  const dataConnect = getDataConnect(app, connectorConfig);
  connectDataConnectEmulator(dataConnect, "localhost", 9399, false);
  useEffect(() => {
    const uid = user?.uid
    if (!uid) return;
    getAccount({ id: uid })
      .then(async (data) => {

      })
  }, [user])
  specVersion: "v1beta"
serviceId: "serviceID"
location: "asia-northeast1"
schema:
  source: "./schema"
  datasource:
    postgresql:
      database: "postgres"
      cloudSql:
        instanceId: "kura-fdc"
      # schemaValidation: "COMPATIBLE"
connectorDirs: ["./connector"]

[REQUIRED] Expected behavior

Data should be retrieved successfully.

[REQUIRED] Actual behavior

{"code":5,"message":"no schema found for service \"ServiceID\". No service has a schema.","details":[]}
google-oss-bot commented 4 days ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

joehan commented 1 day ago

Hey @1amageek, sorry to hear you ran into this issue. To help us debug, could you share the contents of dataconnect-debug.log, firebase-debug.log, and the contents of the dataconnect section of your firebase.json?