Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPNS lambda #166

Closed
gitwoz opened this issue Oct 24, 2024 · 0 comments · Fixed by #167
Closed

Fix IPNS lambda #166

gitwoz opened this issue Oct 24, 2024 · 0 comments · Fixed by #167
Assignees

Comments

@gitwoz
Copy link
Contributor

gitwoz commented Oct 24, 2024

Description

The refresh-ipns-gw3 Lambda handler has failed due to breaking changes in the article table schema.

2024-10-24T14:01:22.417Z	91ea5379-9bb9-4ade-851e-f2eed823dbb6	ERROR	Invoke Error 	{
    "errorType": "PostgresError",
    "errorMessage": "column \"title\" does not exist",
    "code": "42703",
    "stack": [
        "PostgresError: column \"title\" does not exist",
        "    at ErrorResponse (file:///var/task/node_modules/postgres/src/connection.js:768:26)",
        "    at handle (file:///var/task/node_modules/postgres/src/connection.js:471:6)",
        "    at Socket.data (file:///var/task/node_modules/postgres/src/connection.js:312:9)",
        "    at Socket.emit (node:events:517:28)",
        "    at addChunk (node:internal/streams/readable:368:12)",
        "    at readableAddChunk (node:internal/streams/readable:341:9)",
        "    at Readable.push (node:internal/streams/readable:278:10)",
        "    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)",
        "    at new Query (file:///var/task/node_modules/postgres/src/query.js:35:9)",
        "    at sql (file:///var/task/node_modules/postgres/src/index.js:111:11)",
        "    at DbApi.listRecentAuthors (file:///var/task/lib/db.js:111:22)",
        "    at Runtime.handler (file:///var/task/handlers/refresh-ipns-gw3.js:16:37)",
        "    at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)"
    ],
    "query": "-- check latest articles' author ipns_key\nSELECT u2.user_name, u2.display_name, GREATEST(ul.last_at ::date, u2.last_seen ::date) AS last_seen,\n  count_articles, ipns_key, last_data_hash AS top_dir_data_hash, last_published, a.*,\n  concat('https://matters.town/@', u2.user_name, '/', a.id, '-', a.slug) AS last_article_url,\n  priv_key_pem, priv_key_name\nFROM (\n  SELECT DISTINCT ON (author_id) author_id, id, title, slug, summary, data_hash AS last_article_data_hash, media_hash, created_at AS last_article_published\n  FROM article\n  WHERE state IN ('active')\n    AND author_id NOT IN (SELECT user_id FROM user_restriction) -- skip restricted authors\n  ORDER BY author_id, id DESC\n) a\nLEFT JOIN mat_views.users_lasts ul ON author_id=ul.id\nLEFT JOIN public.user u2 ON author_id=u2.id\nLEFT JOIN user_ipns_keys k ON author_id=k.user_id\nLEFT JOIN (\n  SELECT author_id, COUNT(*)::int AS count_articles\n  FROM article\n  WHERE state NOT IN ('archived')\n  GROUP BY 1\n) ta USING (author_id)\n-- WHERE -- WHERE user_name IN ('Brianliu', '...', 'oldcat')\nWHERE u2.state NOT IN ('archived', 'banned')\n  AND a.last_article_published >= $1\n  AND (last_published IS NULL OR last_published < a.last_article_published)\nORDER BY id DESC\nLIMIT $2 OFFSET $3 ",
    "parameters": [
        "2022-01-01",
        10,
        0
    ],
    "args": [
        "2022-01-01",
        10,
        0
    ],
    "types": [
        0,
        0,
        0
    ]
}

Ref

@gitwoz gitwoz self-assigned this Oct 24, 2024
@gitwoz gitwoz linked a pull request Oct 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant