gr2m / universal-github-app-jwt

Calculate GitHub App bearer tokens for Node & modern browsers
MIT License
23 stars 11 forks source link

The requested module '#crypto' does not provide an export named 'subtle' #76

Closed melroyvandenberg closed 10 months ago

melroyvandenberg commented 1 year ago

The package seems to be broken now with the introducing of this #crypto import. I'm using v2.0.5 now of the package. And using universal-github-app-jwt directly, which gives me:

The requested module '#crypto' does not provide an export named 'subtle'

image

Usage example:

import githubAppJwt from "universal-github-app-jwt"

const { token, appId, expiration } = await githubAppJwt({ id: APP_ID, privateKey: PRIVATE_KEY })

Help..

gr2m commented 1 year ago

If you use it directly, what node version are you using? Do you do any bundling? I would need a reproducible test case that does not involve AWS in order to look into it

gr2m commented 10 months ago

closing due to inactivty

groboclown commented 10 months ago

I was able to reproduce this issue. Using docker, this Dockerfile will generate the error message.

FROM ubuntu:latest

RUN apt-get update && apt-get install -y npm=8.5.1~ds-1 nodejs=12.22.9~dfsg-1ubuntu3.1
RUN mkdir /work \
    && cd /work \
    && echo '{ "type": "module" }' > package.json \
    && npm install universal-github-app-jwt \
    && echo 'import githubAppJwt from "universal-github-app-jwt"' > v.js \
    && node v.js
gr2m commented 10 months ago

nodejs=12.22.9

Node 12 is no longer maintained, for a very long time, and it's not supported by this module.

TechQuery commented 4 months ago

@gr2m The same error thrown in 2.2.0 with Deno runtime recently: https://github.com/Yuyz0112/dewhale/actions/runs/9043026122/job/24850220873#step:4:273

gr2m commented 4 months ago

Can you file a new issue please? I'd appreciate help investigating

TechQuery commented 4 months ago

Can you file a new issue please? I'd appreciate help investigating

@gr2m Thanks, but I have no idea about how to describe this issue, and my upstream just fix this bug by pinning a package's version: Yuyz0112/dewhale@2445b94

gr2m commented 4 months ago

if you or @Yuyz0112 could create a minimal reproducible test case of the problem using universal-github-app-jwt directly, I'd be happy to look into it