I am trying to deploy my app that was built using "create-react-app" to Heroku.
I followed all the steps.
When I try to push to Heroku, I get the following error:
Failed to compile.
./src/services/api/securities/index.ts
Cannot find file './keys' in './src/services/api/securities'.
I know why this is.
The 'keys
' file is in my .gitignore
. It contains sensitive API keys, so I want git to ignore it.
Here is the attempt to access the keys in the index.ts fike
export * from './keys'
But it seems that Heroku can't build without it.
Please help.
Its not the Heroku issue, any platform will need files required in the app to build.
Also, sensitive data (keys file) must not be pushed to Git. You will need to make some changes in your app where ever you are requiring keys file, read all those properties from environment variable like process.env.{key_name}, and in Heroku set this sensitive property in the environment variable.
Check this link
https://devcenter.heroku.com/articles/config-vars
Hope you got the idea.