wirejs-deploy-amplify-basic 0.0.129-async-api → 0.0.131-async-api

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,6 @@ function isBackgroundJob(o: any): o is BackgroundJob<any> {
54
54
  }
55
55
 
56
56
  export const handler: LambdaFunctionURLHandler = async (event, context) => {
57
- console.log('lambda invoke', event); // TEMP!
58
57
  const calls = JSON.parse(event.body!);
59
58
 
60
59
  if (Array.isArray(calls)) {
@@ -85,9 +84,13 @@ export const handler: LambdaFunctionURLHandler = async (event, context) => {
85
84
  body: JSON.stringify(responses)
86
85
  }
87
86
  } else if (typeof calls === 'object' && calls.async) {
88
- console.log('handling async execution', calls);
87
+ const sanitized = { ...calls };
88
+ sanitized.selfInvocationId = sanitized.selfInvocationId.slice(0, 8);
89
+
90
+ console.log('handling async execution', sanitized);
89
91
 
90
92
  if (!calls.absoluteId) {
93
+ console.error('Missing absoluteId in async call');
91
94
  return {
92
95
  statusCode: 400,
93
96
  body: JSON.stringify({ error: 'Missing absoluteId' })
@@ -95,6 +98,7 @@ export const handler: LambdaFunctionURLHandler = async (event, context) => {
95
98
  }
96
99
 
97
100
  if (calls.selfInvocationId !== env.SELF_INVOCATION_ID) {
101
+ console.error('Self invocation ID mismatch');
98
102
  return {
99
103
  statusCode: 403,
100
104
  body: JSON.stringify({ error: 'Forbidden' })
@@ -103,13 +107,19 @@ export const handler: LambdaFunctionURLHandler = async (event, context) => {
103
107
 
104
108
  const job = (BackgroundJob as any).registeredJobs[calls.absoluteId];
105
109
  if (!job || !isBackgroundJob(job)) {
110
+ console.error('Background job not found',
111
+ calls.absoluteId,
112
+ (BackgroundJob as any).registeredJobs
113
+ );
106
114
  return {
107
115
  statusCode: 404,
108
116
  body: JSON.stringify({ error: 'Background job not found' })
109
117
  };
110
118
  }
111
119
 
120
+ console.log('Starting background job');
112
121
  await job.start(...calls.args)
122
+ console.log('Background job completed');
113
123
 
114
124
  return {
115
125
  statusCode: 200,
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.41",
6
- "wirejs-resources": "^0.1.97-async-api"
6
+ "wirejs-resources": "^0.1.99-async-api"
7
7
  }
8
8
  }
@@ -49,6 +49,7 @@ export class BackgroundJob extends Resource {
49
49
  Payload: JSON.stringify({
50
50
  // stringified body like the URL handler expects.
51
51
  body: JSON.stringify({
52
+ async: true,
52
53
  absoluteId: this.absoluteId,
53
54
  selfInvocationId: env.SELF_INVOCATION_ID,
54
55
  args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.129-async-api",
3
+ "version": "0.0.131-async-api",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "recursive-copy": "^2.0.14",
43
43
  "rimraf": "^6.0.1",
44
44
  "wirejs-dom": "^1.0.41",
45
- "wirejs-resources": "^0.1.97-async-api"
45
+ "wirejs-resources": "^0.1.99-async-api"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@aws-amplify/backend": "^1.14.0",