cloudflare / cloudflare/wrangler-action

Nodejs Crypto not registered

Open
#386 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.9k
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm getting an error when trying to use Wrangler to deploy a static Hugo site using a Gitea Action Runner. Gitea uses basically the same actions framework that github does, so something like this should be compatible.

Here's my action.yaml
```yaml
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: public
command: pages deploy --project-name=PROJECT
```
and here's the error I get
```log
file:///run/act/actions/3fc7ee91e4d96a84c6667f8949dd987748adc15b29f8cd35270e56008bdef83c/dist/index.mjs:37343
WRANGLER_OUTPUT_DIR: `${(0,external_path_.join)((0,external_os_.tmpdir)(), `wranglerArtifacts-${crypto.randomUUID()}`)}`,
^
ReferenceError: crypto is not defined
at file:///run/act/actions/3fc7ee91e4d96a84c6667f8949dd987748adc15b29f8cd35270e56008bdef83c/dist/index.mjs:37343:101
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:106:12)
Node.js v18.20.8
❌ Failure - Main Deploy
exitcode '1': failure
```
I notice here that the container seems to be wanting to use nodejs 18, which might be the issue, but there's not really a way for me to specify it and looking at the version tag here on github, I should be using the latest version of the action.

Contributor guide

Open the contributing guide

Research direction

Start with the generated action code in dist/index.mjs around line 37343 and the Node.js 18 runtime shown in the error. Reproduce the action from the provided action.yaml on a Gitea Action Runner, then determine why crypto is unavailable; done means the Wrangler action deploys the Hugo site without the ReferenceError.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, node.js, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.