Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'sha') #12

Open
tconroy opened this issue Jul 8, 2022 · 7 comments
Open

TypeError: Cannot read properties of undefined (reading 'sha') #12

tconroy opened this issue Jul 8, 2022 · 7 comments

Comments

@tconroy
Copy link

tconroy commented Jul 8, 2022

Hello! Thank you for your work on this stack, it's really great!

I'm running into a strange issue. I've published some posts, but I can't seem to update them. If I commit and deploy a changes to the markdown file associated with a post, I am still seeing the initial version of that post when deployed to production.

I'm not sure entirely what is causing this issue, but I did notice this error during the Determine Changes step on CI:

Run echo ::set-output name=DEPLOYABLE::$(node ./others/is-deployable.js)
TypeError: Cannot read properties of undefined (reading 'sha')
    at go (/home/runner/work/***/***/others/is-deployable.js:7:30)
    at processTicksAndRejections (node:internal/process/task_queues:9[6](https://github.com/tconroy/my-repo/runs/7243487957?check_suite_focus=true#step:5:7):5)

Wonder if that could be related? I've seen this undefined error relating to sha crop up a few times in my CLI with this stack.

@Girish21
Copy link
Owner

Girish21 commented Jul 8, 2022

Hey!
The script cannot fetch the build sha from the deployed Fly app. The fetch operation happens here.

Can you check if you have configured FLY_APP_NAME as part of the actions secret?

If that is configured correctly, can you visit https://<FLY_APP_NAME>.fly.dev/build/info.json and check if info.json is present and has the sha value. (Sample info.json)

If it's not there, can you check the build logs in GitHub action? (A successful build should look like this).

@tconroy
Copy link
Author

tconroy commented Jul 8, 2022

Thank you for the help!

✅ I just double-checked that I have the FLY_APP_NAME in my GitHub actions secret.

My info.json only contains timestamp:

{
"timestamp": 1657252585158
}

In the build logs, nothing super crazy jumps out to me, other than this line:

#19 4.530 💣 fetch failed with Cannot read properties of undefined (reading 'author')

full npm run build log:

#19 [build 7/7] RUN npm run build
#19 0.408 
#19 0.408 > build
#19 0.408 > run-s build:*
#19 0.408 
#19 0.893 
#19 0.893 > build:css
#19 0.893 > tailwindcss -m -i styles/app.css -o app/styles/app.css
#19 0.893 
#19 2.456 
#19 2.458 Done in 1031ms.
#19 2.826 
#19 2.826 > build:remix
#19 2.826 > remix build && node ./others/build-info.js
#19 2.826 
#19 3.769 Building Remix app in production mode...
#19 4.293 mdx-bundler is possibly an ESM only package and should be bundled with "serverDependenciesToBundle in remix.config.js.
#19 4.308 p-queue is possibly an ESM only package and should be bundled with "serverDependenciesToBundle in remix.config.js.
#19 4.313 remark-autolink-headings is possibly an ESM only package and should be bundled with "serverDependenciesToBundle in remix.config.js.
#19 4.316 remark-gfm is possibly an ESM only package and should be bundled with "serverDependenciesToBundle in remix.config.js.
#19 4.322 remark-slug is possibly an ESM only package and should be bundled with "serverDependenciesToBundle in remix.config.js.
#19 4.373 Built in 602ms
#19 4.530 💣 fetch failed with Cannot read properties of undefined (reading 'author')
#19 4.886 
#19 4.886 > build:server
#19 4.886 > esbuild --platform=node --format=cjs ./server/index.ts --outfile=build/server.js
#19 4.886 
#19 4.898 
#19 4.898   build/server.js  3.2kb
#19 4.898 
#19 4.898 ⚡ Done in 3ms
#19 DONE 4.9s

@tconroy
Copy link
Author

tconroy commented Jul 8, 2022

I also tried to manually trigger a POST call to the https://<MY_FLY_APP>.fly.dev/_content/refresh-content endpoint with the REFRESH_TOKEN and the payload { "refreshAll" true }.

This returns a 500 response from fly.io.

I looked at the logs and saw this (note: i've truncated out my ipv6 address):

2022-07-08T21:03:34.035 app[26745ce4] ewr [info] FetchError: request to http://[fdaa:...:3681:2]:8080/_content/update-content?_data=routes%2F_content%2Fupdate-content failed, reason: getaddrinfo ENOTFOUND [fdaa:0:...:3681:2]
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at ClientRequest.<anonymous> (/app/node_modules/@remix-run/web-fetch/src/fetch.js:111:11)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at ClientRequest.emit (node:events:539:35)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at Socket.socketErrorListener (node:_http_client:454:9)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at Socket.emit (node:events:527:28)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at emitErrorNT (node:internal/streams/destroy:157:8)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at emitErrorCloseNT (node:internal/streams/destroy:122:3)
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] at processTicksAndRejections (node:internal/process/task_queues:83:21) {
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] type: 'system',
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] errno: 'ENOTFOUND',
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] code: 'ENOTFOUND',
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] erroredSysCall: 'getaddrinfo'
2022-07-08T21:03:34.035 app[26745ce4] ewr [info] }
2022-07-08T21:03:34.036 app[26745ce4] ewr [info] POST /_content/refresh-content 500 - - 32.097 ms

This is odd. I'm not sure why the request would fail. I confirmed the IP address is correct (by comparing it with the output of flyctl ips private). any idea why that request would return ENOTFOUND?

@tconroy
Copy link
Author

tconroy commented Jul 8, 2022

Interestingly, I am now seeing the sha info in my info.json. So that's good!

However, I am still not seeing my content refresh.

I think the error above (500 response on the update-content fetch) is the root cause here, but not sure why it's working OK for you but not for me 🤔

2022-07-08T21:55:47.739 app[3047e37b] ewr [info] FetchError: request to http://[fdaa:0:5832:...:...:1:3681:2]:8080/_content/update-content?_data=routes%2F_content%2Fupdate-content failed, reason: getaddrinfo ENOTFOUND [fdaa:0:5832:...:...:1:3681:2]

@Girish21
Copy link
Owner

Girish21 commented Jul 9, 2022

Interestingly, I am now seeing the sha info in my info.json. So that's good!

However, I am still not seeing my content refresh.

I think the error above (500 response on the update-content fetch) is the root cause here, but not sure why it's working OK for you but not for me 🤔

2022-07-08T21:55:47.739 app[3047e37b] ewr [info] FetchError: request to http://[fdaa:0:5832:...:...:1:3681:2]:8080/_content/update-content?_data=routes%2F_content%2Fupdate-content failed, reason: getaddrinfo ENOTFOUND [fdaa:0:5832:...:...:1:3681:2]

I'm facing the same issue. Let me open an issue at Fly. I'm not sure why the fetch call to the IP is failing 😕. Thanks for the report!

@tconroy
Copy link
Author

tconroy commented Jul 11, 2022

Thanks! Please share what you find. I tried starting a thread over in the fly.io community but have not yet gotten an answer.

@tconroy
Copy link
Author

tconroy commented Aug 4, 2022

Just following up on this. I did not get a satisfactory answer from Fly or elsewhere. I ended up hard-coding the address (ie instead of using the ipv6 values, I just did http://<my-domain>.fly.dev. That works, but I worry it wont scale to multiple instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants