Error when deploying

Hello,
While doing the pages tracks I’m not able to deploy., the build runs just fine locally.

The error I’m getting right now reads

“Failed to generate page for feature turtlehead-tacos with locale en, in stream cog-internal-feature-static-file-generation-turtlehead-tacos, due to the following error: NetworkError when attempting to fetch resource.: [at async mainFetch (deno:ext/fetch/26_fetch.js:267:14) at async fetch (deno:ext/fetch/26_fetch.js:491:9) at async Object.y [as transformProps] (Generator-meiilyxehn:src/assets/server/static.f92b4ee4.js:1:1317) at async k (Generator-meiilyxehn:src/assets/renderer/templateRenderer.js:19:1585) at async W (Generator-meiilyxehn:src/assets/renderer/templateRenderer.js:19:2358) at async Generate (Generator-meiilyxehn:src/mod.ts:9:10) at async invoke (plugin-host:worker/worker.ts:106:20) at async self.onmessage (plugin-host:worker/worker.ts:33:22)]”

by looking at the errors I get in the console log in red this line:

2023-03-20T20:39:43Z: #22 1.523 W0320 20:39:43.866417 artifactbundler.go:444] Error attempting to read functions/functionMetadata.json file, err: open /opt/buildhome/repo/functions/functionMetadata.json: no such file or directory

but in the fail section of Page Build Details, get something else:

Cannot add redirect from “/index-old/location14” to “/es/location14”. A redirect from /index-old/location14 already exists

thanks!

Hi Carlos - thanks for your question!

Could you let me know what PagesJS version you are on?

If you run the following command and paste the output here, it would be really helpful:

npx envinfo --system --npmPackages '@yext/pages' --binaries --browsers

Could you also include a link to your deploys page, so I can see the exact details?

Thank you and looking forward to resolving this for you!

Best,
Andrew

hi Andrew, here’s the outputL

System:
OS: macOS 12.6.2
CPU: (8) x64 Intel(R) Core™ i7-8569U CPU @ 2.80GHz
Memory: 64.14 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.7.0 - /usr/local/bin/node
Yarn: 1.22.17 - ~/.yarn/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
Browsers:
Brave Browser: 110.1.48.164
Chrome: 111.0.5563.64
Firefox: 111.0
Safari: 15.6.1
npmPackages:
@yext/pages: 1.0.0-beta.16 => 1.0.0-beta.16

thanks!

Thanks, Carlos. Could you also include a link to your deploys page, so I can see the exact details?
~Andrew

sure thing
https://sandbox.yext.com/s/3197398/yextsites/134788/branch/4787/deploys/recent

@Joseph_Valenciano - tagging you in here as your redirect issue seems like it may be stemming from the same problem!

Hi Carlos,

Thanks for sending the link. The error messages I see in your account are due to the fact that certain environment variables which the starter relies are on not set.

In the starter, there is a .env file as you can see here which defines YEXT_PUBLIC_UNVERSE among some other variables.

You have three options:

  1. You can commit the .env file into your repository with the environment variables defined and redeploy
  2. You can add those variables as platform environment variables as documented here Environment Variables | Hitchhikers
  3. You can also remove any references to env vars in your code

Let me know if that works!

Thanks and best,
Andrew

Hi @Andrew_Sanchez, added the .env to the repo for testing and it worked.

thanks a lot for your help!

(I removed the .env file from the repo and added the values as platform environment variables and still works -phew!- )

Great to hear! Let us know if anything else comes up.

Best,
Andrew