Skip to content

ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING error when using ESM script to render #160

Description

@aKzenT

When trying to use a ESM script with the library I'm getting a ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING error on the line that dynamically imports the script.

A dynamic import callback was not specified. TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified. at new NodeError (node:internal/errors:399:5) at importModuleDynamicallyCallback (node:internal/modules/esm/utils:89:9) at Http2ServerRequest. ([eval]:1:3021) at Http2ServerRequest.emit (node:events:512:28) at endReadableNT (node:internal/streams/readable:1359:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Jering.Javascript.NodeJS.HttpNodeJSService.TryInvokeAsync[T](InvocationRequest invocationRequest, CancellationToken cancellationToken)
at Jering.Javascript.NodeJS.OutOfProcessNodeJSService.TryInvokeCoreAsync[T](InvocationRequest invocationRequest, CancellationToken cancellationToken)
at Jering.Javascript.NodeJS.OutOfProcessNodeJSService.InvokeFromFileAsync[T](String modulePath, String exportName, Object[] args, CancellationToken cancellationToken)

This is the line from the Javascript.NodeJS library minified script that causes the exception:

      a = e.endsWith(".mjs") ? await import("file:///" + e.replaceAll("\\", "/")) : require(e)

The script with "mjs" extension looks very simple:

export default async(data) => {
  console.log("render called");
  return Promise.resolve("Test");
};

The strange thing is also that initially it does seem to work, so some calls are successful, but then it stops working with that error.

Any ideas?

I'm using node 19.7.0 and 7.0.0-beta3 of this library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions