Skip to content

Bug in fs promise APIs #59023

Description

@theanarkh

Version

main

Platform

MacOS

Subsystem

fs

What steps will reproduce the bug?

// node --permission demo.mjs
import fs from "fs"

await fs.promises.mkdtemp('asdf')

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

throw an error: Error: Access to this API has been restricted. Use --allow-fs-write to manage permissions.

What do you see instead?

throw and error: TypeError: Method Promise.prototype.then called on incompatible receiver undefined.

Additional information

This is because C++ layer does not return the promise to JS layer(just reject the promise in C++ layer) when an error occurs(Libuv error or permission error).

Refs: #58747 and #58996

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

    fsIssues and PRs related to file-system APIs and the fs module.permissionIssues and PRs related to the Permission Model.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions