Conversation
… package-lock.json
There was a problem hiding this comment.
Bug: SQS Message Parsing Error
A consistent typo uses parma1 instead of param1 when destructuring the SQS message body. This prevents the intended parameter (likely a subreddit name) from being correctly extracted, causing parma1 to be undefined. This undefined value is then used in subsequent logic, including calls to ragSubredditPaginator, leading to runtime errors and incorrect processing.
packages/cli/src/templates/background-agent/src/functions/sqs-index.ts.txt#L32-L136
Bug: SQS Handler Parameter Mismatch
The sqs-index.ts handler incorrectly destructures parma1 from the SQS message body, while message producers (e.g., cron-paginate.ts) send the relevant data under the subreddit property. This mismatch results in parma1 being undefined, causing parameter validation to fail and preventing the intended subreddit indexing. The variable parma1 is likely a typo.
packages/cli/src/templates/background-agent/src/functions/sqs-index.ts.txt#L32-L133
packages/cli/src/templates/background-agent/src/functions/cron-paginate.ts.txt#L32-L33
Bug: Incorrect Template Path Causes Project Creation Error
The createBackgroundAgentProject function uses an incorrect path for template files. path.resolve(__dirname, 'background-agent') resolves to packages/cli/src/commands/background-agent/, but the templates are actually located at packages/cli/src/templates/background-agent/. This leads to a runtime error (directory not found) when attempting to create a background agent. The path should be path.resolve(__dirname, '../templates/background-agent').
packages/cli/src/commands/kickstart.ts#L124-L125
microfox/packages/cli/src/commands/kickstart.ts
Lines 124 to 125 in c5ec61a
Bug: Environment Variable Mismatch in SQS Queue URL
The cron-paginate.ts handler attempts to send messages to the SQS index queue using process.env.INDEX_SUBREDDIT_QUEUE_URL. However, the serverless.yml template defines the index queue URL as INDEX_QUEUE_URL for other functions, and PAGINATE_QUEUE_URL for cronPaginate itself. This mismatch means INDEX_SUBREDDIT_QUEUE_URL is undefined at runtime, preventing messages from being sent to the SQS index queue.
packages/cli/src/templates/background-agent/serverless.yml.txt#L51-L74
packages/cli/src/templates/background-agent/src/functions/cron-paginate.ts.txt#L103-L109
Bug: Environment Mismatch and Async Handling Bug
The route-trigger-index.ts handler contains two bugs:
- Environment Variable Mismatch: The code references
process.env.INDEX_SUBREDDIT_QUEUE_URL(lines 47, 92, 95) but the corresponding environment variable is defined asINDEX_QUEUE_URLinserverless.yml. This mismatch results in an undefined SQS queue URL, breaking message sending functionality. - Missing Await: The
indexSubredditHandler(an async function) is called withoutawait(line 88) whenisOfflineis true. This can lead to unhandled promise rejections or incorrect error handling in offline mode.
packages/cli/src/templates/background-agent/src/functions/route-trigger-index.ts.txt#L46-L95
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.