mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
added workflow to allow me to debug quicker
This commit is contained in:
parent
deccdb0dea
commit
537239c3ee
2 changed files with 43 additions and 8 deletions
29
.github/workflows/nextjs-build.yml
vendored
Normal file
29
.github/workflows/nextjs-build.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: Next.js Build Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**" # all branches
|
||||
pull_request:
|
||||
branches:
|
||||
- "**" # all PRs
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build Next.js app
|
||||
run: npm run build
|
||||
|
|
@ -22,8 +22,11 @@ let cachedQueueUrl: string | null = null;
|
|||
export async function getQueueUrl(queueName: string): Promise<string> {
|
||||
if (cachedQueueUrl) return cachedQueueUrl;
|
||||
|
||||
const resp = await sqsClient.send(new GetQueueUrlCommand({ QueueName: queueName }));
|
||||
if (!resp.QueueUrl) throw new Error(`Could not resolve SQS URL for queue: ${queueName}`);
|
||||
const resp = await sqsClient.send(
|
||||
new GetQueueUrlCommand({ QueueName: queueName })
|
||||
);
|
||||
if (!resp.QueueUrl)
|
||||
throw new Error(`Could not resolve SQS URL for queue: ${queueName}`);
|
||||
cachedQueueUrl = resp.QueueUrl;
|
||||
return cachedQueueUrl;
|
||||
}
|
||||
|
|
@ -42,8 +45,10 @@ export async function sendToQueue(
|
|||
messageBody: unknown,
|
||||
opts: SendOptions = {}
|
||||
): Promise<SendMessageCommandOutput> {
|
||||
const queueName = opts.queueName ?? (process.env.AWS_SQS_QUEUE_NAME as string);
|
||||
if (!queueName) throw new Error("Missing AWS_SQS_QUEUE_NAME or sendToQueue opts.queueName");
|
||||
const queueName =
|
||||
opts.queueName ?? (process.env.AWS_SQS_QUEUE_NAME as string);
|
||||
if (!queueName)
|
||||
throw new Error("Missing AWS_SQS_QUEUE_NAME or sendToQueue opts.queueName");
|
||||
|
||||
const queueUrl = await getQueueUrl(queueName);
|
||||
|
||||
|
|
@ -56,7 +61,8 @@ export async function sendToQueue(
|
|||
const isFifo = queueUrl.endsWith(".fifo");
|
||||
if (isFifo) {
|
||||
params.MessageGroupId = opts.groupId ?? "default-group";
|
||||
if (opts.deduplicationId) params.MessageDeduplicationId = opts.deduplicationId;
|
||||
if (opts.deduplicationId)
|
||||
params.MessageDeduplicationId = opts.deduplicationId;
|
||||
}
|
||||
|
||||
if (typeof opts.delaySeconds === "number") {
|
||||
|
|
@ -71,8 +77,8 @@ export async function sendToQueue(
|
|||
* Optionally filter by name prefix.
|
||||
*/
|
||||
export async function listQueues(prefix?: string): Promise<string[]> {
|
||||
const resp = await sqsClient.send(new ListQueuesCommand(
|
||||
prefix ? { QueueNamePrefix: prefix } : {}
|
||||
));
|
||||
const resp = await sqsClient.send(
|
||||
new ListQueuesCommand(prefix ? { QueueNamePrefix: prefix } : {})
|
||||
);
|
||||
return resp.QueueUrls ?? [];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue