-
-
Notifications
You must be signed in to change notification settings - Fork 461
DomainRedirects with env vars #838
Comments
The code tries to create a URL from the given value, if there is an exception then it's not a valid URL:
Is it because you are missing the protocol e.g |
I have the same issue on @1.19.0-alpha.21 Hardcoded value like this works:
This fails:
(I've tried without the quotations too) Here's the log output:
|
The error is the same, it is because |
Update: it seems it might be an issue with Serverless Framework? I did see a few very similate issues recently where if you have See for a workaround: #530 (comment) It also doesn't work for me, my recommendation is don't use concatenated env variable or workaround above. I'll close this issue for now since there appears to be a workaround and update the docs to mention this. |
Thanks @dphang |
For anyone else running into this issue, I've tried the following: domain: ${env.DOMAIN}
subdomain: ${env.SUBDOMAIN}
myNextApplication:
...
inputs:
...
domain:
- ${env.SUBDOMAIN}
- ${env.DOMAIN}
domainType: "both"
domainRedirects:
"${domain}": https://${subdomain}.${domain} And also without the quotes, so So despite using the workaround for concatenating env vars: #530 (comment), still no joy. When I export the Lambda function I can see in the
So I assume that's the issue right there, it's not able to expand an environment variable when it's used as the YAML key? But the value does work just fine. I've just switched to hardcoding, which works and is not really the end of the world either! |
I have the following configuration
Describe the bug
I want to use env var to define redirection but it fails (it works with hardcoded values)
Actual behavior
The deployment fails (see logs)
Expected behavior
I should have the same behavior with env vars
Steps to reproduce
deploy a domain redirection with env vars
Screenshots/Code/Logs
Error: domainRedirects: domain.com is invalid. The URL is not in a valid URL format. at Builder.normalizeDomainRedirects (/root/.serverless/components/registry/npm/@sls-next/serverless-component@1.18.0/node_modules/@sls-next/lambda-at-edge/dist/build.js:435:23)
Versions
Additional context
Checklist
latest
oralpha
@sls-next/serverless-component
release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.The text was updated successfully, but these errors were encountered: