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
[Bug] Error when using secureDistribution
and privateCDN
instead of cloudName
#375
Comments
hey @cprussin im having a hard time reproducing this on latest i removed my environment variable and with my logs and changes shown below, im able to see the values, and the images load in my browser
i tried adding your will keep looking at this after some meetings and see if im missing something |
secureDistribution
instead of cloudName
ah sorry @colbyfayock I should have been more clear, the bug is actually triggered by explicitly leaving If you look at https://github.com/cloudinary/js-url-gen/blob/e1b97191fff165b6ecb353acb2477cc25a062667/src/assets/CloudinaryFile.ts#L182-L193, there must be a value for |
ohh you know i noticed that empty string but i was thinking it was just from the example you shared will get this addressed but yes please, if you dont mind, creating an issue for URL-gen as well |
url-gen issue: cloudinary/js-url-gen#588 |
secureDistribution
instead of cloudName
secureDistribution
and privateCDN
instead of cloudName
@colbyfayock on further thought you probably shouldn't touch this lib until the url-gen ticket gets resolved, as presumably any error messaging you add here should be consistent with url-gen's underrlying error messaging |
i think that makes sense however I'm just not sure of the timeline of them getting that fixed, but i can get mine fixed right away by adding a more explicit undefined check
while an empty string shouldnt technically be a valid value, i would prefer the library to be in a working state even if it requires a little hack like you have, and i can unblock you for that |
Up to you -- I wouldn't worry too much about it as it's trivial to work around by just setting If anything maybe this should just be a doc change between now and when, if ever, it's fixed in the underlying. |
Bug Report
Error thrown when setting cloud name via props instead of using env vars.
Describe the bug
Using
CldImage
like this:is valid and works correctly (however setting
cloudName
to an empty string is necessary, see cloudinary/js-url-gen#588), however due to #353 now causes an exception (Error: A Cloudinary Cloud name is required ...
) to be thrown.The fix is to set either
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
orconfig.cloud.cloudName
to some dummy value, even though the value isn't actually used anywhere.Is this a regression?
Yes, regression was added in #353
Steps To Reproduce the error
<CldImage config={{ url: { secureDistribution: "foo", privateCdn: true }, cloud: { cloudName: "" } }} ... />
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
Expected behaviour
No exception if the config props contain the necessary configs (i.e. only throw an exception if both
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
is missing and the config prop is missing the necessary values)The text was updated successfully, but these errors were encountered: