developerFolio icon indicating copy to clipboard operation
developerFolio copied to clipboard

Github not connecting with the site on deployment

Open theinit01 opened this issue 1 year ago β€’ 2 comments

Describe the bug

GitHub projects and profile picture isn't showing after deployment. It was working during development.

Steps to reproduce

  1. Go to https://theinit01.github.io/portfolio/#opensource
  2. Scroll down 3.. See error

Expected behavior

Github projects and contact me section should have been updated.

Is this responsiveness Issue

No

Screenshots

No response

Desktop

  • OS: [e.g. iOS]
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]

Smartphones

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

No response

theinit01 avatar Oct 15 '23 14:10 theinit01

I had the same problem. What happens is that when will deploy the application the archive profile.json is not the same path in development.

Screenshot 2023-11-18 151652

Screenshot 2023-11-18 151718

To fix in your machine:

import packageJson from "../../../package.json";

...

 fetch(`${packageJson.homepage}/profile.json`)

This will work in production. In dev mode will need use the current solution.

Or you could remove too /portfolio of your homepage in package.json

rogigs avatar Nov 18 '23 18:11 rogigs

I recently encountered a similar issue. When I changed the homepage field in package.json to my own domain on gh-pages (instead of https://developerfolio.js.org/), the application would not work locally. Interestingly, removing the homepage field altogether seemed to resolve the issue locally. However, this is not a viable solution for build/production.

The issue, as @rogigs pointed out, seems to be that the application cannot access profile.json from the public folder while using fetch in the different components that require the profile data. This occurs when a domain other than the original is provided for the homepage field.

As a temporary workaround, I copied the file to the src folder as well, enabling direct access from the components. You can see the changes I made in this commit.

While this solution works for now, it’s not ideal. If anyone has a more permanent fix, it would be greatly appreciated.

Dereje1 avatar Jan 09 '24 07:01 Dereje1