Skip to content

Comments

fix: use system temp dir for AJV cache to fix Windows EPERM error#13243

Merged
czubocha merged 1 commit intomainfrom
fix-eperm-windows
Jan 13, 2026
Merged

fix: use system temp dir for AJV cache to fix Windows EPERM error#13243
czubocha merged 1 commit intomainfrom
fix-eperm-windows

Conversation

@czubocha
Copy link
Contributor

@czubocha czubocha commented Jan 13, 2026

Fix Windows CI EPERM error in AJV schema validation cache

Problem

The Windows CI runner was failing intermittently with:

EPERM: operation not permitted, rename 'C:\a\serverless\serverless\packages\sf-core\sls-ajvqlvHza...' -> 'C:\Users\runneradmin.serverless\artifacts\ajv-validate-...'

Root Cause

The fsp.mkdtemp('sls-ajv') call in resolve-ajv-validate.js was creating temporary directories in the current working directory instead of the system temp directory.

On Windows CI:

  • Source: C:\a\serverless\...\sls-ajvXXX\ (project workspace)
  • Dest: C:\Users\runneradmin\.serverless\... (user home)

These are in different permission zones, causing EPERM errors during the atomic rename operation due to permission restrictions or file handle timing issues.

Solution

Changed mkdtemp to use the proper system temp directory:

// Before
const tmpDir = await fsp.mkdtemp('sls-ajv')

// After
const tmpDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'sls-ajv'))

@Mmarzex
Copy link
Contributor

Mmarzex commented Jan 13, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@czubocha czubocha merged commit 089bb05 into main Jan 13, 2026
10 checks passed
@czubocha czubocha deleted the fix-eperm-windows branch January 13, 2026 12:29
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants