open-sauced / landing-page

This is the new landing page for open sauced
https://opensauced.pizza
30 stars 29 forks source link

Bug: Latest Changelog throwing a 500 when clicked #345

Closed BekahHW closed 2 weeks ago

BekahHW commented 2 weeks ago

Describe the bug

When you click the SBOM changelog post at the top of the changelog page, you get a 500 error.

Steps to reproduce

  1. Go to https://opensauced.pizza/changelog
  2. Click the SBOM page
nickytonline commented 2 weeks ago

If you run it locally in dev mode, this is the error surfaced.

CleanShot 2024-08-26 at 12 25 09

It appears to be an invalid query from the Sanity API

 ⨯ ClientError: expected ']' following expression
    at onResponse (/Users/taco/dev/landing-page/node_modules/@sanity/client/lib/http/request.js:28:13)
    at applyMiddleware (/Users/taco/dev/landing-page/node_modules/@sanity/client/node_modules/get-it/lib-node/util/middlewareReducer.js:10:15)
    at onResponse (/Users/taco/dev/landing-page/node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:80:22)
    at /Users/taco/dev/landing-page/node_modules/@sanity/client/node_modules/get-it/lib-node/index.js:50:55
    at callback (/Users/taco/dev/landing-page/node_modules/@sanity/client/node_modules/get-it/lib-node/request/node-request.js:67:46)
    at /Users/taco/dev/landing-page/node_modules/@sanity/client/node_modules/get-it/lib-node/request/node-request.js:156:14
    at DestroyableTransform.<anonymous> (/Users/taco/dev/landing-page/node_modules/simple-concat/index.js:8:13)
    at Object.onceWrapper (node:events:633:28)
    at DestroyableTransform.emit (node:events:531:35)
    at endReadableNT (/Users/taco/dev/landing-page/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  response: {
    body: { error: [Object] },
    url: "our_sanity_url",
    method: 'GET',
    headers: {
      'content-type': 'application/json; charset=utf-8',
      'x-ratelimit-limit-second': '500',
      'ratelimit-limit': '500',
      'ratelimit-remaining': '499',
      'ratelimit-reset': '1',
      'x-ratelimit-remaining-second': '499',
      date: 'Mon, 26 Aug 2024 16:25:00 GMT',
      'content-encoding': 'gzip',
      'server-timing': 'api;dur=4',
      vary: 'Accept-Encoding, origin',
      'strict-transport-security': 'max-age=63072000; includeSubDomains; preload',
      xkey: 'project-r7m53vrk, project-r7m53vrk-production',
      via: '1.1 google',
      'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
      'transfer-encoding': 'chunked'
    },
    statusCode: 400,
    statusMessage: 'Bad Request'
  },
  statusCode: 400,
  responseBody: '{\n' +
    '  "error": {\n' +
    `    "description": "expected ']' following expression",\n` +
    '    "end": 119,\n' +
    `    "query": "\\n    *[_type == 'changelog' && !(_id in path('drafts.**')) && slug.current == 'generate-a-workspace-from-a-repository's-software-bill-of-materials'] {\\n      ...,\\n    }[0]\\n  ",\n` +
    '    "start": 6,\n' +
    '    "type": "queryParseError"\n' +
    '  }\n' +
    '}',
  details: {
    description: "expected ']' following expression",
    end: 119,
    query: '\n' +
      "    *[_type == 'changelog' && !(_id in path('drafts.**')) && slug.current == 'generate-a-workspace-from-a-repository's-software-bill-of-materials'] {\n" +
      '      ...,\n' +
      '    }[0]\n' +
      '  ',
    start: 6,
    type: 'queryParseError'
  },
  page: "/changelog/generate-a-workspace-from-a-repository's-software-bill-of-materials"
}
BekahHW commented 2 weeks ago

@nickytonline the issue was the apostrophe in the slug. It works now since I updated it. I don't think it's worth it to explore this any further, since we want to avoid apostrophes in the slugs for SEO purposes as well. But wanted to see if you have thoughts before I close this.