Open petrosoft-fi opened 1 year ago
Confirming that I see the same behaviour.
When attempting to deploy with a top level domain I get the error Found zones: [] for dns:com, privateZone:undefined, vpcId:undefined, but wanted exactly 1 zone
which lead me to this same conclusion. replacing my FQDN with www.mydomain.com
fixes the issue.
Description of the bug The SvelteKit adapter for AWS does not support using top-level domains (e.g., domain.com) as FQDN values. It only works correctly with subdomains (e.g., subdomain.domain.com) and third level domains (e.g. domain.co.uk).
In the current production version, the domainName variable incorrectly receives the value "com" when using "google.com" as an FQDN. Instead, it should be assigned the correct value, which in this case is "google.com".
Steps to reproduce the behavior:
Expected behavior The adapter should work correctly with top-level domains, third level domains and subdomains as FQDN values.
Additional context A potential fix for this issue is to modify the adapter-stack.js file to handle both second-level top-level domains (e.g., domain.co.uk) and regular top-level domains (e.g., domain.com):
const domainParts = ((_b = process.env.FQDN) === null || _b === void 0 ? void 0 : _b.split('.')) || [];
const isSecondLevelTLD = domainParts.length >= 3 && domainParts[domainParts.length - 2].length === 2;
const domainName = domainParts.slice(isSecondLevelTLD ? -3 : -2).join('.');
This code works as follows:
With this code, the main domain should be correctly determined for cases like www.domain.com, domain.com, domain.co.uk, and subdomain.domain.co.uk.