Skip to content

Stacks API looks like it is up and responds truthy when blockchain config is missing events_observer block. #1553

Closed
@muthusleuths

Description

@muthusleuths

Describe the bug
While running a Stacks 2.1 Radon blockchain node alongside Stacks API v7 it throws the below error when /extended/v1/block endpoint is called during genesis sync

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://github.com/stacks-network/stacks-blockchain-docker'
  2. Update config for 'Stacks 2.1 Radon or rc4(mainnet) and API v7.0.0'
  3. Begin a genesis sync
  4. See below error
stacks-blockchain-api  | {"level":"error","message":"HTTP GET /extended/v1/block","req":{"headers":{"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","accept-encoding":"gzip, deflate","accept-language":"en-US,en;q=0.9","cache-control":"max-age=0","connection":"keep-alive","host":"3.228.177.236:3999","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"},"httpVersion":"1.1","method":"GET","originalUrl":"/extended/v1/block","query":{},"url":"/extended/v1/block"},"res":{"statusCode":500},"responseTime":139,"timestamp":"2023-02-13T21:51:08.464Z"}
stacks-blockchain-api  | {"date":"Mon Feb 13 2023 21:51:08 GMT+0000 (Coordinated Universal Time)","error":{"errorTag":"bbae3ad3-7f7d-479f-8b53-bb866a1bcaca"},"exception":true,"level":"error","message":"middlewareError","req":{"headers":{"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","accept-encoding":"gzip, deflate","accept-language":"en-US,en;q=0.9","cache-control":"max-age=0","connection":"keep-alive","host":"3.228.177.236:3999","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"},"httpVersion":"1.1","method":"GET","originalUrl":"/extended/v1/block","query":{},"url":"/extended/v1/block"},"stack":"TypeError: Cannot read properties of undefined (reading 'count')\n    at /app/src/datastore/pg-store.ts:488:41\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at scope (/app/node_modules/postgres/cjs/src/index.js:222:18)\n    at Function.begin (/app/node_modules/postgres/cjs/src/index.js:209:14)\n    at PgStore.getBlocksWithMetadata (/app/src/datastore/pg-store.ts:483:12)\n    at getBlocksWithMetadata (/app/src/api/controllers/db-controller.ts:559:18)\n    at /app/src/api/routes/block.ts:22:34","timestamp":"2023-02-13T21:51:08.466Z"}
stacks-blockchain-api  | TypeError: Cannot read properties of undefined (reading 'count')
stacks-blockchain-api  |     at /app/src/datastore/pg-store.ts:488:41
stacks-blockchain-api  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
stacks-blockchain-api  |     at scope (/app/node_modules/postgres/cjs/src/index.js:222:18)
stacks-blockchain-api  |     at Function.begin (/app/node_modules/postgres/cjs/src/index.js:209:14)
stacks-blockchain-api  |     at PgStore.getBlocksWithMetadata (/app/src/datastore/pg-store.ts:483:12)
stacks-blockchain-api  |     at getBlocksWithMetadata (/app/src/api/controllers/db-controller.ts:559:18)
stacks-blockchain-api  |     at /app/src/api/routes/block.ts:22:34

Expected behavior
It returns the recent blocks around what block height /v2/info endpoint returns

Screenshots
Screen Shot 2023-02-13 at 5 02 43 PM
Screen Shot 2023-02-13 at 5 02 56 PM
Screen Shot 2023-02-13 at 5 03 07 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions