Skip to content

process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN produces undefined #10

Open
@stormasm

Description

@stormasm

const httpLink = new HttpLink({
uri: 'https://api.github.com/graphql',
headers: {
authorization: Bearer ${ process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN },
},
});

The process.env code is unreliable and for me on slower browsers I get an UNDEFINED...

When I replace that code with the solution below it all works.
It is possible that I may be the only one seeing an issue with this...
And if that is the case then your solution works great !

However, in doing some research on the internet I have noticed other people's issues
with Webpack, process.env etc...

I have implemented what I believe to be a much more robust solution for getting the
github-auth-token

You can check it out....
If you like the idea we can scope out me doing a pull request to change the current implementation.

Here is an explanation of my change.

https://github.com/stormasm/garg/blob/master/Readme.md

We could come up with a design where the user simply has to edit a file
we have already created and pop in their github-auth-token...

About as simple as having to edit an ENVIRONMENT variable.

The other solution might be to wrap that code in an async / wait...
But that seems way more complicated...
Curious to know what others think...

Thanks,
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions