Closed tkgregory closed 2 weeks ago
This is the code deployed to AWS as described. The issue does not show itself when running locally.
https://github.com/tkgregory/bannerflex.git
Nuxt includes a cdnURL configuration option to specify "An absolute URL to serve the public folder from (production-only)."
I don't think this option is respected in the Nuxt Content module.
I am deploying to AWS Lambda using the aws_lambda Nitro preset.
aws_lambda
/
/static/
My lambda function has the environment variable: NUXT_APP_CDN_URL: https://d13yx967ab4do4.cloudfront.net/static/
NUXT_APP_CDN_URL: https://d13yx967ab4do4.cloudfront.net/static/
My application is a single Vue component which reads a .yml file via Nuxt Content (view source).
.yml
<script lang="ts" setup> const pricing = await queryContent('/pricing').findOne() </script> <template> <main> <p>Found {{ pricing.prices.length }} items in /pricing</p> </main> </template>
Access the deployed application to see the following errors yourself here here.
Viewing source shows resources served from /static/ e.g. JS.
<link rel="prefetch" as="script" crossorigin href="https://d13yx967ab4do4.cloudfront.net/static/_nuxt/SPCSjI8F.js">
This makes me believe NUXT_APP_CDN_URL has taken effect for core application.
NUXT_APP_CDN_URL
But Network tab shows 404 error fetching content:
404
https://d13yx967ab4do4.cloudfront.net/api/_content/query/BeNxk91izP.1730146068844.json?_params=%7B%22first%22:true,%22where%22:%5B%7B%22_path%22:%22%2Fpricing%22%7D%5D,%22sort%22:%5B%7B%22_stem%22:1,%22$numeric%22:true%7D%5D%7D
Error response body is {"message":"Not Found"}
{"message":"Not Found"}
Hence page fails to load and we see blank screen.
I expect the page to load OK.
I can see this JSON file is available https://d13yx967ab4do4.cloudfront.net/static/api/_content/cache.1730146068844.json.
https://d13yx967ab4do4.cloudfront.net/static/api/_content/cache.1730146068844.json
I may be doing something wrong here, but my suspicion is Nuxt Content is looking for the JSON file in the wrong location.
nuxt dev
node .output/server/index.mjs
<ContentDoc>
No response
This was a misconfiguration of the Lambda function API gateway integration.
Needed to specify a path for the HTTP API of /{proxy+} instead of / to catch all paths
/{proxy+}
Environment
Build Modules: -
Reproduction
This is the code deployed to AWS as described. The issue does not show itself when running locally.
https://github.com/tkgregory/bannerflex.git
Describe the bug
Nuxt includes a cdnURL configuration option to specify "An absolute URL to serve the public folder from (production-only)."
I don't think this option is respected in the Nuxt Content module.
Environment
I am deploying to AWS Lambda using the
aws_lambda
Nitro preset./
(my app has a single page) — contents of .output/server/static/
— contents of .output/public.My lambda function has the environment variable:
NUXT_APP_CDN_URL: https://d13yx967ab4do4.cloudfront.net/static/
Issue
My application is a single Vue component which reads a
.yml
file via Nuxt Content (view source).Access the deployed application to see the following errors yourself here here.
Viewing source shows resources served from
/static/
e.g. JS.This makes me believe
NUXT_APP_CDN_URL
has taken effect for core application.But Network tab shows
404
error fetching content:Error response body is
{"message":"Not Found"}
Hence page fails to load and we see blank screen.
Expectation
I expect the page to load OK.
I can see this JSON file is available
https://d13yx967ab4do4.cloudfront.net/static/api/_content/cache.1730146068844.json
.I may be doing something wrong here, but my suspicion is Nuxt Content is looking for the JSON file in the wrong location.
What else did I try?
nuxt dev
OKnode .output/server/index.mjs
OK<ContentDoc>
OKAdditional context
No response
Logs
No response