Error during 'fastly compute init'

I can see the following error during fastly compute init -i -l javascript
can you please advice?
fastly version: Fastly CLI version v10.6.4 (484d3861)

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

webpack 5.89.0 compiled with 1 warning in 98 ms

> build
> js-compute-runtime bin/index.js bin/main.wasm

file:///home/tchelet/fastly/noname_package/node_modules/@fastly/js-compute/js-compute-runtime-cli.js:18
} = await parseInputs(process.argv.slice(2))
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)
--------------------------------------------------------------------------------

ERROR: error during execution process (see 'command output' above): exit status 1.

Here are some steps you can follow to debug the issue:

Hi @tchelet - it looks like you have a syntax error in your code.

If you can share your code, we can take a look and help point out the error.

but the following it’s a Fastly code.

file:///home/tchelet/fastly/noname_package/node_modules/@fastly/js-compute/js-compute-runtime-cli.js:18
} = await parseInputs(process.argv.slice(2))
    ^^^^^

this is my beginning code, I’m not sure I can send the full code.

/// <reference types="@fastly/js-compute" />
import { allowDynamicBackends } from "fastly:experimental";
import { Backend } from "fastly:backend";
import { Logger } from "fastly:logger";

allowDynamicBackends(true);

const SOURCE_TYPE = 54
const SOURCE_INDEX = "{{ SOURCE_INDEX }}"
const SOURCE_KEY = "{{ SOURCE_KEY }}"

const LOGGER_NAME = "noname_logger";
const MAX_BODY_SIZE = 63500;

let totalRead = 0;

It might be related to the JavaScript version you have installed. Try updating to see if it fixes the error for you. Let me know if that fixes the issue for you.

1 Like

Thank you. it resolves the issue :slight_smile: .

1 Like