Comments (17)
Thank you for the explanation and the links. I will take the time to read the discussion and test the different workarounds.
I very appreciated your help ⛑️ and your reactivity!
A big THANK YOU for all your contributions to the open-source community 👍
from auth-app.js.
Thank you for the explanation and the links. I will take the time to read the discussion and test the different workarounds.
I very appreciated your help ⛑️ and your reactivity!
A big THANK YOU for all your contributions to the open-source community 👍
Did you ever find a workaround for this?
from auth-app.js.
This issue webpack/webpack#5756 could explain why my app is using the code under dist-web
and not dist-node
.
I tested this webpack/webpack#5756 (comment) and it loads the correct code, but it's not an option because it introduces potential side effects 😕
I tried to downgrade to "@octokit/auth-app": "^2.0.1" (so before introducing the browser compatibility) and I can execute the code without issue.
from auth-app.js.
@gr2m yes I think we can close it. Also in recent nodejs release (v16) atob
is expose as global nodejs/node#37786 so it probably fixes (in a way) the issue.
from auth-app.js.
In what environment are you running your app? Server or browser?
from auth-app.js.
I wonder where universal-github-app-jwt
is coming from, it's not a dependency of @octokit/auth-app.js
?
from auth-app.js.
Hi @gr2m,
Thank you for your quick reply!
In what environment are you running your app? Server or browser?
My app is an AWS serverless Lambda running Node V12.16.1
I wonder where universal-github-app-jwt is coming from, it's not a dependency of @octokit/auth-app.js?
I'm not sure to understand the question, but universal-github-app-jwt
has been introduced in @octokit/auth-app.js by #19
from auth-app.js.
It's strange; my app seems to be detected as running in a browser because before hitting this error, I've been requested to convert my private key using:
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in private-key.pem -out private-key-pkcs8.key
but the README indicates, Node handles both:
No conversation is needed in Node, both PKCS#1 and PKCS#8 format will work.
from auth-app.js.
I'm not sure to understand the question, but universal-github-app-jwt has been introduced in @octokit/auth-app.js by #19
Sorry, I mixed up what repository I was in 🤦♂ please ignore my comment.
This is all a problem with creating universal libraries (and build tools), it's really a pain. There is no standard that everyone agrees on. We have a lengthy discussion here about a similar problem: gr2m/universal-user-agent#23 I hope that you find a workaround workaround there for you?
I hope that build tools add support for conditional exports, recently introduced to Node.js: https://nodejs.org/api/esm.html#esm_conditional_exports. This will be the right tool for the job, but until webpack and friends support it, it's going to be frustrating to all of us, I'm very sorry :(
from auth-app.js.
HI, I have the same error here with AWS lambda and node 12.x and serverless framework.
package.json:
"@octokit/auth-app": "^2.4.15", "@octokit/core": "^3.1.2",
I solve the problem by commenting the line below from the serverless.yml
plugins:
- serverless-offline
- serverless-prune-plugin
# - serverless-webpack
custom:
prune:
automatic: true
number: 3
from auth-app.js.
can we close the issue? The proper solution to this will be to implement the @octokit modules as native ES Modules and take advantage of conditional exports which are support by webpack, rollup, and esbuild now. But this is going to be a bigger project, there is nothing we can do in the meanwhile on our side to address the original problem of this issue. Use the suggested workarounds instead
from auth-app.js.
For anyone else coming across this, the @octokit/auth-app
package defines:
Now @rollup/node-resolve uses this default:
which means that even when building for node it will pull dist-web/index.js
.
You can fix it by teaching your rollup in the config to resolve to the main field first:
nodeResolve({
mainFields: ['main', 'module']
}),
however this is a global setting, so you will change precedence for other modules as well.
@gr2m would it make sense to move the web dist to the browser
field? E.g.:
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"main": "dist-node/index.js",
"module": "dist-node/index.js",
"browser": "dist-web/index.js"
I think semantically it makes more sense?
from auth-app.js.
I think semantically it makes more sense?
yes, unfortunately it's not that easy. The @pika/pack
package we use is no longer maintained, we are looking into creating up our own build setup, which will export a proper ESM build, with conditional exports for Node, browsers, and deno, where necessary.
Eventually we will probably get rid of the build step altogether and just build native ES Modules, and move TypeScript definitions to .d.ts
files. But will take a while
from auth-app.js.
from auth-app.js.
It’s not that easy. The browser build is the esm build. I don’t want to patch the setup we have with post build changes, I want to replace the whole build setup, it’s not an easy fix, unfortunately
from auth-app.js.
from auth-app.js.
I'm stuck on Node v12 and am running into this building with webpack so I can deploy to IBM Cloud functions. My config is simple:
module.exports = {
entry: {
webhook: './actions/Webhook.js',
probot: './actions/Probot.js',
},
target: 'node',
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
optimization: {
minimize: false
}
};
Not sure what my options are?
from auth-app.js.
Related Issues (20)
- [FEAT]: When will the conversion to ESM happen? HOT 1
- Getting the correct `installation_id` to use HOT 5
- [BUG]: secretOrPrivateKey size error when size is larger enough HOT 4
- Backed authentication user-to-server without device flow
- [BUG]: ReferenceError: Property 'atob' doesn't exist HOT 9
- [BUG]: secretOrPrivateKey must be an asymmetric key when using RS256 HOT 28
- [BUG]: package files not published to npm HOT 1
- [BUG]: unable to use this package with `@actions/github-script` HOT 19
- [DOCS]: Node version requirements HOT 3
- Replace `toMatchObject` Response assertions with `toEqual` in `auth-app.js` HOT 1
- [DOCS]: Implementation of GitHub App user authentication token with expiring disabled HOT 6
- [BUG]: Cache#get type doesn't allow promises HOT 2
- [BUG]: Upgrade universal-github-app-jwt 1.1.2 to close CVE-2022-25883 HOT 5
- Default flow results in error for missing installationId HOT 5
- [BUG]: `octokit.request("PATCH /app/hook/config", { url })` throws error `installationId option is required for installation authentication` HOT 1
- [BUG]: Handle 403 responses same as 401 responses in the first 3 seconds after an installation access token was created HOT 1
- [BUG]: /app/installation-requests missing from PATHS in requires-app-auth HOT 3
- Revisit skipped tests HOT 1
- `appId` can now be set to the application's Client ID HOT 2
- [MAINT]: use stable `semantic-release` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth-app.js.