Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions integration-tests/worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @openfn/integration-tests-worker

## 1.0.95

### Patch Changes

- 84bebf4: Fix an issue where certain error messages are badly processed the runtime & worker. This resulted in cryptic errors like "src.js is not in the SourceMap".
- @openfn/engine-multi@1.6.13
- @openfn/lightning-mock@2.2.8
- @openfn/ws-worker@1.15.4

## 1.0.94

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openfn/integration-tests-worker",
"private": true,
"version": "1.0.94",
"version": "1.0.95",
"description": "Lightning WOrker integration tests",
"author": "Open Function Group <admin@openfn.org>",
"license": "ISC",
Expand Down
24 changes: 24 additions & 0 deletions integration-tests/worker/test/exit-reasons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ test('crash: syntax error', async (t) => {
t.regex(error_message, /Unexpected token \(1:9\)$/);
});

// https://github.com/OpenFn/kit/issues/1045
test('crash: reference error', async (t) => {
const attempt = {
id: crypto.randomUUID(),
jobs: [
{
name: 'x', // important!
adaptor: '@openfn/language-common@latest',
body: 'fn((s) => s.err.map(s => s))',
},
],
};

const result = await run(attempt);

const { reason, error_type, error_message } = result;
t.is(reason, 'fail');
t.is(error_type, 'RuntimeError');
t.regex(
error_message,
/TypeError: Cannot read properties of undefined \(reading \'map\'\)/
);
});

// https://github.com/OpenFn/kit/issues/758
test('crash: job not found', async (t) => {
lightning.addDataclip('x', {});
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @openfn/cli

## 1.15.2

### Patch Changes

- Updated dependencies [84bebf4]
- @openfn/runtime@1.7.3

## 1.15.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.15.1",
"version": "1.15.2",
"description": "CLI devtools for the OpenFn toolchain",
"engines": {
"node": ">=18",
Expand Down
7 changes: 7 additions & 0 deletions packages/engine-multi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# engine-multi

## 1.6.13

### Patch Changes

- Updated dependencies [84bebf4]
- @openfn/runtime@1.7.3

## 1.6.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-multi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/engine-multi",
"version": "1.6.12",
"version": "1.6.13",
"description": "Multi-process runtime engine",
"main": "dist/index.js",
"type": "module",
Expand Down
8 changes: 8 additions & 0 deletions packages/lightning-mock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/lightning-mock

## 2.2.8

### Patch Changes

- Updated dependencies [84bebf4]
- @openfn/runtime@1.7.3
- @openfn/engine-multi@1.6.13

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/lightning-mock/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/lightning-mock",
"version": "2.2.7",
"version": "2.2.8",
"private": true,
"description": "A mock Lightning server",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/runtime

## 1.7.3

### Patch Changes

- 84bebf4: Fix an issue where certain error messages are badly processed the runtime & worker. This resulted in cryptic errors like "src.js is not in the SourceMap".

## 1.7.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/runtime",
"version": "1.7.2",
"version": "1.7.3",
"description": "Job processing runtime.",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/src/util/sourcemap-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default async (job: Job, error: RTError) => {
}

if (error.pos && !isNaN(error.pos.line!)) {
// TODO how to handle file name properly here?
const src = smc.sourceContentFor('src.js')!.split('\n');
const fileName = job.name ? `${job.name}.js` : 'src.js';
const src = smc.sourceContentFor(fileName)!.split('\n');
const line = src[error.pos.line! - 1];
error.pos.src = line;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/runtime/test/util/sourcemap-errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { RTError } from '../../src';
const b = recast.types.builders;

// compile an expression into a function
const compile = (src: string) => {
const compile = (src: string, sourceFileName = 'src.js') => {
const ast = recast.parse(src, {
sourceFileName: 'src.js',
sourceFileName,
});

// take the expression and wrap it in a function declaration
Expand All @@ -22,12 +22,12 @@ const compile = (src: string) => {
ast.program.body.push(fn);

return recast.print(fn, {
sourceMapName: 'src.map.js',
sourceMapName: `${sourceFileName.replace('.js', '.map.js')}`,
});
};

test('should write the step name to the error', async (t) => {
const { code, map } = compile('x + 1');
const { code, map } = compile('x + 1', 'yyy.js');

// create a fake job
const job = {
Expand Down
8 changes: 8 additions & 0 deletions packages/ws-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ws-worker

## 1.15.4

### Patch Changes

- Updated dependencies [84bebf4]
- @openfn/runtime@1.7.3
- @openfn/engine-multi@1.6.13

## 1.15.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/ws-worker",
"version": "1.15.3",
"version": "1.15.4",
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
"main": "dist/index.js",
"type": "module",
Expand Down